JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); } /* /********************************************************** /* DeserializerFactory API implementation /********************************************************** */ /** * Method that {@link DeserializerCache}s call to create a new * deserializer for types other than Collections, Maps, arrays and * enums. */ @Override public JsonDeserializer<Object> createBeanDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); // We may also have custom overrides: JsonDeserializer<Object> custom = _findCustomBeanDeserializer(type, config, beanDesc); if (custom != null) { return custom; } /* One more thing to check: do we have an exception type * (Throwable or its sub-classes)? If so, need slightly * different handling. */ if (type.isThrowable()) { return buildThrowableDeserializer(ctxt, type, beanDesc); } /* Or, for abstract types, may have alternate means for resolution * (defaulting, materialization) */ // 29-Nov-2015, tatu: Also, filter out calls to primitive types, they are // not something we could materialize anything for if (type.isAbstract() && !type.isPrimitive()) { // Let's make it possible to materialize abstract types. JavaType concreteType = materializeAbstractType(ctxt, type, beanDesc); if (concreteType != null) { /* important: introspect actual implementation (abstract class or * interface doesn't have constructors, for one) */ beanDesc = config.introspect(concreteType); return buildBeanDeserializer(ctxt, concreteType, beanDesc); } } // Otherwise, may want to check handlers for standard types, from superclass: @SuppressWarnings("unchecked") JsonDeserializer<Object> deser = (JsonDeserializer<Object>) findStdDeserializer(ctxt, type, beanDesc); if (deser != null) { return deser; } // Otherwise: could the class be a Bean class? If not, bail out if (!isPotentialBeanType(type.getRawClass())) { return null; } // Use generic bean introspection to build deserializer return buildBeanDeserializer(ctxt, type, beanDesc); } @Override public JsonDeserializer<Object> createBuilderBasedDeserializer( DeserializationContext ctxt, JavaType valueType, BeanDescription beanDesc, Class<?> builderClass) throws JsonMappingException { // First: need a BeanDescription for

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Method(buildMethodName, null); if (buildMethod != null) { // note: can't yet throw error; may be given build method if (config.canOverrideAccessModifiers()) { ClassUtil.checkAndFixAccess(buildMethod.getMember(), config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } } builder.setPOJOBuilder(buildMethod, builderConfig); // this may give us more information... if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { builder = mod.updateBuilder(config, builderDesc, builder); } } JsonDeserializer<?> deserializer = builder.buildBuilderBased( valueType, buildMethodName); // [JACKSON-440]: may have modifier(s) that wants to modify or replace serializer we just built: if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { deserializer = mod.modifyDeserializer(config, builderDesc, deserializer); } } return (JsonDeserializer<Object>) deserializer; } protected void addObjectIdReader(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException { ObjectIdInfo objectIdInfo = beanDesc.getObjectIdInfo(); if (objectIdInfo == null) { return; } Class<?> implClass = objectIdInfo.getGeneratorType(); JavaType idType; SettableBeanProperty idProp; ObjectIdGenerator<?> gen; ObjectIdResolver resolver = ctxt.objectIdResolverInstance(beanDesc.getClassInfo(), objectIdInfo); // Just one special case: Property-based generator is trickier if (implClass == ObjectIdGenerators.PropertyGenerator.class) { // most special one, needs extra work PropertyName propName = objectIdInfo.getPropertyName(); idProp = builder.findProperty(propName); if (idProp == null) { throw new IllegalArgumentException("Invalid Object Id definition for " +beanDesc.getBeanClass().getName()+": can not find property with name '"+propName+"'"); } idType = idProp.getType(); gen = new PropertyBasedObjectIdGenerator(objectIdInfo.getScope()); } else { JavaType type = ctxt.constructType(implClass); idType = ctxt.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0]; idProp = null; gen = ctxt.objectIdGeneratorInstance(beanDesc.getClassInfo(), objectIdInfo); } // also: unlike with value deserializers, let's just resolve one we need here JsonDeserializer<?> deser = ctxt.findRootValueDeserializer(idType); builder.setObjectIdReader(ObjectIdReader.construct(idType, objectIdInfo.getPropertyName(), gen, deser, idProp, resolver)); } @SuppressWarnings("unchecked") public JsonDeserializer

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.updateProperties(ctxt.getConfig(), beanDesc, propDefs); } } // At which point we still have all kinds of properties; not all with mutators: for (BeanPropertyDefinition propDef : propDefs) { SettableBeanProperty prop = null; /* 18-Oct-2013, tatu: Although constructor parameters have highest precedence, * we need to do linkage (as per [databind#318]), and so need to start with * other types, and only then create constructor parameter, if any. */ if (propDef.hasSetter()) { JavaType propertyType = propDef.getSetter().getParameterType(0); prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); } else if (propDef.hasField()) { JavaType propertyType = propDef.getField().getType(); prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); } else if (useGettersAsSetters && propDef.hasGetter()) { /* May also need to consider getters * for Map/Collection properties; but with lowest precedence */ AnnotatedMethod getter = propDef.getGetter(); // should only consider Collections and Maps, for now? Class<?> rawPropertyType = getter.getRawType(); if (Collection.class.isAssignableFrom(rawPropertyType) || Map.class.isAssignableFrom(rawPropertyType)) { prop = constructSetterlessProperty(ctxt, beanDesc, propDef); } } // 25-Sep-2014, tatu: No point in finding constructor parameters for abstract types // (since they are never used anyway) if (isConcrete && propDef.hasConstructorParameter()) { /* If property is passed via constructor parameter, we must * handle things in special way. Not sure what is the most optimal way... * for now, let's just call a (new) method in builder, which does nothing. */ // but let's call a method just to allow custom builders to be aware... final String name = propDef.getName(); CreatorProperty cprop = null; if (creatorProps != null) { for (SettableBeanProperty cp : creatorProps) { if (name.equals(cp.getName()) && (cp instanceof CreatorProperty)) { cprop = (CreatorProperty) cp; break; } } } if (cprop == null) { throw ctxt.mappingException("Could not find creator property with name '%s' (in class %s)", name, beanDesc.getBeanClass().getName()); } if (prop != null) { cprop.setFallbackSetter(prop); } prop = cprop; builder.addCreatorProperty(cprop); continue; } if (prop != null) { Class<?>[] views = propDef.findViews(); if (views == null)

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> { // one more twist: if default inclusion disabled, need to force empty set of views if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) { views = NO_VIEWS; } } // one more thing before adding to builder: copy any metadata prop.setViews(views); builder.addProperty(prop); } } } /** * Helper method called to filter out explicit ignored properties, * as well as properties that have "ignorable types". * Note that this will not remove properties that have no * setters. */ protected List<BeanPropertyDefinition> filterBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder, List<BeanPropertyDefinition> propDefsIn, Set<String> ignored) throws JsonMappingException { ArrayList<BeanPropertyDefinition> result = new ArrayList<BeanPropertyDefinition>( Math.max(4, propDefsIn.size())); HashMap<Class<?>,Boolean> ignoredTypes = new HashMap<Class<?>,Boolean>(); // These are all valid setters, but we do need to introspect bit more for (BeanPropertyDefinition property : propDefsIn) { String name = property.getName(); if (ignored.contains(name)) { // explicit ignoral using @JsonIgnoreProperties needs to block entries continue; } if (!property.hasConstructorParameter()) { // never skip constructor params Class<?> rawPropertyType = null; if (property.hasSetter()) { rawPropertyType = property.getSetter().getRawParameterType(0); } else if (property.hasField()) { rawPropertyType = property.getField().getRawType(); } // [JACKSON-429] Some types are declared as ignorable as well if ((rawPropertyType != null) && (isIgnorableType(ctxt.getConfig(), beanDesc, rawPropertyType, ignoredTypes))) { // important: make ignorable, to avoid errors if value is actually seen builder.addIgnorable(name); continue; } } result.add(property); } return result; } /** * Method that will find if bean has any managed- or back-reference properties, * and if so add them to bean, to be linked during resolution phase. */ protected void addReferenceProperties(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException { // and then back references, not necessarily found as regular properties Map<String,AnnotatedMember> refs = beanDesc.findBackReferenceProperties(); if (refs != null) { for (Map.Entry<String, AnnotatedMember> en : refs.entrySet()) { String name = en.getKey(); AnnotatedMember m = en.getValue(); JavaType type; if (m instanceof AnnotatedMethod) { type = ((AnnotatedMethod) m).getParameterType(0); } else { type =

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> m.getType(); } SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct( ctxt.getConfig(), m); builder.addBackReferenceProperty(name, constructSettableProperty( ctxt, beanDesc, propDef, type)); } } } /** * Method called locate all members used for value injection (if any), * constructor {@link com.fasterxml.jackson.databind.deser.impl.ValueInjector} instances, and add them to builder. */ protected void addInjectables(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException { Map<Object, AnnotatedMember> raw = beanDesc.findInjectables(); if (raw != null) { boolean fixAccess = ctxt.canOverrideAccessModifiers(); boolean forceAccess = fixAccess && ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); for (Map.Entry<Object, AnnotatedMember> entry : raw.entrySet()) { AnnotatedMember m = entry.getValue(); if (fixAccess) { m.fixAccess(forceAccess); // to ensure we can call it } builder.addInjectable(PropertyName.construct(m.getName()), m.getType(), beanDesc.getClassAnnotations(), m, entry.getKey()); } } } /** * Method called to construct fallback {@link SettableAnyProperty} * for handling unknown bean properties, given a method that * has been designated as such setter. */ protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedMethod setter) throws JsonMappingException { if (ctxt.canOverrideAccessModifiers()) { setter.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); // to ensure we can call it } // we know it's a 2-arg method, second arg is the value JavaType type = setter.getParameterType(1); BeanProperty.Std property = new BeanProperty.Std(PropertyName.construct(setter.getName()), type, null, beanDesc.getClassAnnotations(), setter, PropertyMetadata.STD_OPTIONAL); type = resolveType(ctxt, beanDesc, type, setter); /* AnySetter can be annotated with @JsonDeserialize (etc) just like a * regular setter... so let's see if those are used. * Returns null if no annotations, in which case binding will * be done at a later point. */ JsonDeserializer<Object> deser = findDeserializerFromAnnotation(ctxt, setter); /* Otherwise, method may specify more specific (sub-)class for * value (no need to check if explicit deser was specified): */ type = modifyTypeByAnnotation(ctxt, setter, type); if (deser == null) { deser = type.getValueHandler(); } TypeDeserializer typeDeser = type.getTypeHandler(); return

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> new SettableAnyProperty(property, setter, type, deser, typeDeser); } type = modifyTypeByAnnotation(ctxt, mutator, type); TypeDeserializer typeDeser = type.getTypeHandler(); SettableBeanProperty prop; if (mutator instanceof AnnotatedMethod) { prop = new MethodProperty(propDef, type, typeDeser, beanDesc.getClassAnnotations(), (AnnotatedMethod) mutator); } else { prop = new FieldProperty(propDef, type, typeDeser, beanDesc.getClassAnnotations(), (AnnotatedField) mutator); } if (propDeser != null) { prop = prop.withValueDeserializer(propDeser); } // need to retain name of managed forward references: AnnotationIntrospector.ReferenceProperty ref = propDef.findReferenceType(); if (ref != null && ref.isManagedReference()) { prop.setManagedReferenceName(ref.getName()); } ObjectIdInfo objectIdInfo = propDef.findObjectIdInfo(); if(objectIdInfo != null){ prop.setObjectIdInfo(objectIdInfo); } return prop; } /** * Method that will construct a regular bean property setter using * the given setter method. */ protected SettableBeanProperty constructSetterlessProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef) throws JsonMappingException { final AnnotatedMethod getter = propDef.getGetter(); // need to ensure it is callable now: if (ctxt.canOverrideAccessModifiers()) { getter.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } JavaType type = getter.getType(); // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, getter); type = modifyTypeByAnnotation(ctxt, getter, type); // As per [Issue#501], need full resolution: type = resolveType(ctxt, beanDesc, type, getter); TypeDeserializer typeDeser = type.getTypeHandler(); SettableBeanProperty prop = new SetterlessProperty(propDef, type, typeDeser, beanDesc.getClassAnnotations(), getter); if (propDeser != null) { prop = prop.withValueDeserializer(propDeser); } return prop; } /* /********************************************************** /* Helper methods for Bean deserializer, other /********************************************************** */ /** * Helper method used to skip processing for types that we know * can not be (i.e. are never consider to be) beans: * things like primitives, Arrays, Enums, and proxy types. *<p> * Note that usually we shouldn't really be getting these sort of * types anyway; but better safe than sorry. */ protected boolean isPotentialBeanType(

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Class<?> type) { String typeStr = ClassUtil.canBeABeanType(type); if (typeStr != null) { throw new IllegalArgumentException("Can not deserialize Class "+type.getName()+" (of type "+typeStr+") as a Bean"); } if (ClassUtil.isProxyType(type)) { throw new IllegalArgumentException("Can not deserialize Proxy class "+type.getName()+" as a Bean"); } /* also: can't deserialize some local classes: static are ok; in-method not; * and with [JACKSON-594], other non-static inner classes are ok */ typeStr = ClassUtil.isLocalType(type, true); if (typeStr != null) { throw new IllegalArgumentException("Can not deserialize Class "+type.getName()+" (of type "+typeStr+") as a Bean"); } return true; } /** * Helper method that will check whether given raw type is marked as always ignorable * (for purpose of ignoring properties with type) */ protected boolean isIgnorableType(DeserializationConfig config, BeanDescription beanDesc, Class<?> type, Map<Class<?>,Boolean> ignoredTypes) { Boolean status = ignoredTypes.get(type); if (status != null) { return status.booleanValue(); } BeanDescription desc = config.introspectClassAnnotations(type); status = config.getAnnotationIntrospector().isIgnorableType(desc.getClassInfo()); // We default to 'false', i.e. not ignorable return (status == null) ? false : status.booleanValue(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Address.class) { kind = Std.STD_INET_ADDRESS; } else if (rawType == InetSocketAddress.class) { kind = Std.STD_INET_SOCKET_ADDRESS; } else { return null; } return new Std(rawType, kind); } /* /********************************************************** /* Deserializer implementations /********************************************************** */ @SuppressWarnings("unchecked") @Override public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Issue#381 if (p.getCurrentToken() == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final T value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array"); } return value; } // 22-Sep-2012, tatu: For 2.1, use this new method, may force coercion: String text = p.getValueAsString(); if (text != null) { // has String representation if (text.length() == 0 || (text = text.trim()).length() == 0) { // 04-Feb-2013, tatu: Usually should become null; but not always return _deserializeFromEmptyString(); } Exception cause = null; try { T result = _deserialize(text, ctxt); if (result != null) { return result; } } catch (IllegalArgumentException iae) { cause = iae; } String msg = "not a valid textual representation"; if (cause != null) { String m2 = cause.getMessage(); if (m2 != null) { msg = msg + ", problem: "+m2; } } JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg); if (cause != null) { e.initCause(cause); } throw e; // nothing to do here, yet? We'll fail anyway } if (p.getCurrentToken() == JsonToken.VALUE_EMBEDDED_OBJECT) { // Trivial cases; null to null, instance of type itself returned as is Object ob = p.getEmbeddedObject(); if (ob == null) { return null; } if (_valueClass.isAssignableFrom(ob.getClass())) { return (T) ob; } return _deserializeEmbedded(ob, ctxt); } throw ctxt.mappingException(_valueClass); } protected abstract T _deserialize(String value, DeserializationContext ctxt) throws IOException; protected T _

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>deserializeEmbedded(Object ob, DeserializationContext ctxt) throws IOException { // default impl: error out throw ctxt.mappingException("Don't know how to convert embedded Object of type %s into %s", ob.getClass().getName(), _valueClass.getName()); } protected T _deserializeFromEmptyString() throws IOException { return null; } /* /********************************************************** /* A general-purpose implementation /********************************************************** */ /** * "Chameleon" deserializer that works on simple types that are deserialized * from a simple String. * * @since 2.4 */ public static class Std extends FromStringDeserializer<Object> { private static final long serialVersionUID = 1; public final static int STD_FILE = 1; public final static int STD_URL = 2; public final static int STD_URI = 3; public final static int STD_CLASS = 4; public final static int STD_JAVA_TYPE = 5; public final static int STD_CURRENCY = 6; public final static int STD_PATTERN = 7; public final static int STD_LOCALE = 8; public final static int STD_CHARSET = 9; public final static int STD_TIME_ZONE = 10; public final static int STD_INET_ADDRESS = 11; public final static int STD_INET_SOCKET_ADDRESS = 12; protected final int _kind; protected Std(Class<?> valueType, int kind) { super(valueType); _kind = kind; } @Override protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException { switch (_kind) { case STD_FILE: return new File(value); case STD_URL: return new URL(value); case STD_URI: return URI.create(value); case STD_CLASS: try { return ctxt.findClass(value); } catch (Exception e) { throw ctxt.instantiationException(_valueClass, ClassUtil.getRootCause(e)); } case STD_JAVA_TYPE: return ctxt.getTypeFactory().constructFromCanonical(value); case STD_CURRENCY: // will throw IAE if unknown: return Currency.getInstance(value); case STD_PATTERN: // will throw IAE (or its subclass) if malformed return Pattern.compile(value); case STD_LOCALE: { int ix = _firstHyphenOrUnderscore(value); if (ix < 0) { // single argument return new Locale(value); } String first = value.substring(0, ix); value = value.substring(ix+1); ix = _firstHyphenOrUnderscore(value); if (ix < 0) { // two pieces return new Locale(first, value); } String second

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /********************************************************** /* Overridden methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { set(instance, _managedProperty.deserialize(p, ctxt)); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { return setAndReturn(instance, deserialize(p, ctxt)); } @Override public final void set(Object instance, Object value) throws IOException { setAndReturn(instance, value); } @Override public Object setAndReturn(Object instance, Object value) throws IOException { /* 04-Feb-2014, tatu: As per [#390], it may be necessary to switch the * ordering of forward/backward references, and start with back ref. */ if (value != null) { if (_isContainer) { // ok, this gets ugly... but has to do for now if (value instanceof Object[]) { for (Object ob : (Object[]) value) { if (ob != null) { _backProperty.set(ob, instance); } } } else if (value instanceof Collection<?>) { for (Object ob : (Collection<?>) value) { if (ob != null) { _backProperty.set(ob, instance); } } } else if (value instanceof Map<?,?>) { for (Object ob : ((Map<?,?>) value).values()) { if (ob != null) { _backProperty.set(ob, instance); } } } else { throw new IllegalStateException("Unsupported container type ("+value.getClass().getName() +") when resolving reference '"+_referenceName+"'"); } } else { _backProperty.set(value, instance); } } // and then the forward reference itself return _managedProperty.setAndReturn(instance, value); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> do not necessarily support * update-existing-value operation (esp. immutable types) */ public T deserialize(JsonParser p, DeserializationContext ctxt, T intoValue) throws IOException, JsonProcessingException { throw new UnsupportedOperationException("Can not update object of type " +intoValue.getClass().getName()+" (by deserializer of type "+getClass().getName()+")"); } /** * Deserialization called when type being deserialized is defined to * contain additional type identifier, to allow for correctly * instantiating correct subtype. This can be due to annotation on * type (or its supertype), or due to global settings without * annotations. *<p> * Default implementation may work for some types, but ideally subclasses * should not rely on current default implementation. * Implementation is mostly provided to avoid compilation errors with older * code. * * @param typeDeserializer Deserializer to use for handling type information */ public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // We could try calling return typeDeserializer.deserializeTypedFromAny(p, ctxt); } /* /********************************************************** /* Fluent factory methods for constructing decorated versions /********************************************************** */ /** * Method that will return deserializer instance that is able * to handle "unwrapped" value instances * If no unwrapped instance can be constructed, will simply * return this object as-is. *<p> * Default implementation just returns 'this' * indicating that no unwrapped variant exists */ public JsonDeserializer<T> unwrappingDeserializer(NameTransformer unwrapper) { return this; } /** * Method that can be called to try to replace deserializer this deserializer * delegates calls to. If not supported (either this deserializer does not * delegate anything; or it does not want any changes), should either * throw {@link UnsupportedOperationException} (if operation does not * make sense or is not allowed); or return this deserializer as is. * * @since 2.1 */ public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee) { throw new UnsupportedOperationException(); } /* /********************************************************** /* Introspection methods for figuring out configuration/setup /* of this deserializer instance and/or type it handles /********************************************************** */ /** * Method for accessing type of values this deserializer produces. * Note that this information is not guaranteed to be exact -- it * may be a more generic (super-type) -- but it should not be * incorrect (return a non-related type). *<p> * Default implementation will return null, which means almost same * same as returning <code>Object.class</code> would; that is, that * nothing is known about handled type. *<p> * @since 2.3 */ public Class<?> handledType() {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * for types. Or, if type should never be converted from empty * String, method can also throw an exception. *<p> * Since version 2.6 (in which the context argument was added), call is * expected to be made each and every time an empty value is needed. *<p> * Default implementation simple calls {@link #getNullValue} and * returns value. * * @since 2.6 Added to replace earlier no-arguments variant */ public T getEmptyValue(DeserializationContext ctxt) throws JsonMappingException { // Change the direction in 2.7 return getEmptyValue(); } /** * Accessor that can be used to check whether this deserializer * is expecting to possibly get an Object Identifier value instead of full value * serialization, and if so, should be able to resolve it to actual * Object instance to return as deserialized value. *<p> * Default implementation returns null, as support can not be implemented * generically. Some standard deserializers (most notably * {@link com.fasterxml.jackson.databind.deser.BeanDeserializer}) * do implement this feature, and may return reader instance, depending on exact * configuration of instance (which is based on type, and referring property). * * @return ObjectIdReader used for resolving possible Object Identifier * value, instead of full value serialization, if deserializer can do that; * null if no Object Id is expected. * * @since 2.0 */ public ObjectIdReader getObjectIdReader() { return null; } /** * Method needed by {@link BeanDeserializerFactory} to properly link * managed- and back-reference pairs. * * @since 2.2 (was moved out of <code>BeanDeserializerBase</code>) */ public SettableBeanProperty findBackReference(String refName) { throw new IllegalArgumentException("Can not handle managed/back reference '"+refName +"': type: value deserializer of type "+getClass().getName()+" does not support them"); } /* /********************************************************** /* Deprecated methods /********************************************************** */ /** * @deprecated Since 2.6 Use overloaded variant that takes context argument */ @Deprecated public T getNullValue() { return null; } /** * @deprecated Since 2.6 Use overloaded variant that takes context argument */ @Deprecated public T getEmptyValue() { return getNullValue(); } /* /********************************************************** /* Helper classes /********************************************************** */ /** * This marker class is only to be used with annotations, to * indicate that <b>no deserializer is configured</b>. *<p> * Specifically, this class is to be used as the marker for * annotation {@link com.fasterxml.jackson.databind.annotation.JsonDeserialize} */ public abstract static class None extends JsonDeserializer<Object> { private None()

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> sub-classing. */ protected StdDelegatingDeserializer<T> withDelegate(Converter<Object,T> converter, JavaType delegateType, JsonDeserializer<?> delegateDeserializer) { if (getClass() != StdDelegatingDeserializer.class) { throw new IllegalStateException("Sub-class "+getClass().getName()+" must override 'withDelegate'"); } return new StdDelegatingDeserializer<T>(converter, delegateType, delegateDeserializer); } /* /********************************************************** /* Contextualization /********************************************************** */ @Override public void resolve(DeserializationContext ctxt) throws JsonMappingException { if (_delegateDeserializer != null && _delegateDeserializer instanceof ResolvableDeserializer) { ((ResolvableDeserializer) _delegateDeserializer).resolve(ctxt); } } @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // First: if already got serializer to delegate to, contextualize it: if (_delegateDeserializer != null) { JsonDeserializer<?> deser = ctxt.handleSecondaryContextualization(_delegateDeserializer, property, _delegateType); if (deser != _delegateDeserializer) { return withDelegate(_converter, _delegateType, deser); } return this; } // Otherwise: figure out what is the fully generic delegate type, then find deserializer JavaType delegateType = _converter.getInputType(ctxt.getTypeFactory()); return withDelegate(_converter, delegateType, ctxt.findContextualValueDeserializer(delegateType, property)); } /* /********************************************************** /* Accessors /********************************************************** */ @Override public JsonDeserializer<?> getDelegatee() { return _delegateDeserializer; } @Override public Class<?> handledType() { return _delegateDeserializer.handledType(); } /* /********************************************************** /* Serialization /********************************************************** */ @Override public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Object delegateValue = _delegateDeserializer.deserialize(p, ctxt); if (delegateValue == null) { return null; } return convertValue(delegateValue); } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { /* 12-Apr-2016, tatu: As predicted, earlier handling does not work * (see [databind#1189] for details). There does not seem to be any compelling * way to combine polymorphic types, Converters, but the least sucky way * is probably to use Converter and ignore polymorphic type. Alternative * would be to try to change `TypeDeserializer` to accept `Converter` to * invoke... but that is more intrusive, yet not guaranteeing success. */ // method called up to 2.7.3: // Object delegateValue = _delegateDeserializer.deserialize

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>WithType(p, ctxt, typeDeserializer); // method called since 2.7.4 Object delegateValue = _delegateDeserializer.deserialize(p, ctxt); if (delegateValue == null) { return null; } return convertValue(delegateValue); } @SuppressWarnings("unchecked") @Override public T deserialize(JsonParser p, DeserializationContext ctxt, Object intoValue) throws IOException { if (_delegateType.getRawClass().isAssignableFrom(intoValue.getClass())){ return (T) _delegateDeserializer.deserialize(p, ctxt, intoValue); } return (T) _handleIncompatibleUpdateValue(p, ctxt, intoValue); } /** * Overridable handler method called when {@link #deserialize(JsonParser, DeserializationContext, Object)} * has been called with a value that is not compatible with delegate value. * Since no conversion are expected for such "updateValue" case, this is normally not * an operation that can be permitted, and the default behavior is to throw exception. * Sub-classes may choose to try alternative approach if they have more information on * exact usage and constraints. * * @since 2.6 */ protected Object _handleIncompatibleUpdateValue(JsonParser p, DeserializationContext ctxt, Object intoValue) throws IOException { throw new UnsupportedOperationException(String.format ("Can not update object of type %s (using deserializer for type %s)" +intoValue.getClass().getName(), _delegateType)); } /* /********************************************************** /* Overridable methods /********************************************************** */ /** * Method called to convert from "delegate value" (which was deserialized * from JSON using standard Jackson deserializer for delegate type) * into desired target type. *<P> * The default implementation uses configured {@link Converter} to do * conversion. * * @param delegateValue * * @return Result of conversion */ protected T convertValue(Object delegateValue) { return _converter.convert(delegateValue); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Other(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken curr = p.getCurrentToken(); // [databind#381] if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS) && p.isExpectedStartArrayToken()) { p.nextToken(); final Object parsed = deserialize(p, ctxt); curr = p.nextToken(); if (curr != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _enumClass().getName() + "' value but there was more than a single value in the array"); } return parsed; } throw ctxt.mappingException(_enumClass()); } protected void _failOnNumber(DeserializationContext ctxt, JsonParser p, int index) throws IOException { throw InvalidFormatException.from(p, String.format("Not allowed to deserialize Enum value out of JSON number (%d): disable DeserializationConfig.DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS to allow", index), index, _enumClass()); } protected Class<?> _enumClass() { return handledType(); } protected CompactStringObjectMap _getToStringLookup() { CompactStringObjectMap lookup = _lookupByToString; // note: exact locking not needed; all we care for here is to try to // reduce contention for the initial resolution if (lookup == null) { synchronized (this) { lookup = EnumResolver.constructUnsafeUsingToString(_enumClass()) .constructLookup(); } _lookupByToString = lookup; } return lookup; } /* /********************************************************** /* Additional helper classes /********************************************************** */ /** * Deserializer that uses a single-String static factory method * for locating Enum values by String id. */ protected static class FactoryBasedDeserializer extends StdDeserializer<Object> implements ContextualDeserializer { private static final long serialVersionUID = 1; // Marker type; null if String expected; otherwise numeric wrapper protected final Class<?> _inputType; protected final Method _factory; protected final JsonDeserializer<?> _deser; public FactoryBasedDeserializer(Class<?> cls, AnnotatedMethod f, Class<?> inputType) { super(cls); _factory = f.getAnnotated(); _inputType = inputType; _deser = null; } protected FactoryBasedDeserializer(FactoryBasedDeserializer base, JsonDeserializer<?> deser) { super(base._valueClass); _inputType = base._inputType; _factory = base._factory; _deser = deser; } @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if ((_deser == null) && (_inputType != String.class)) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.type; import java.util.*; import com.fasterxml.jackson.databind.JavaType; /** * Simple recursive-descent parser for parsing canonical {@link JavaType} * representations and constructing type instances. */ public class TypeParser implements java.io.Serializable { private static final long serialVersionUID = 1L; protected final TypeFactory _factory; public TypeParser(TypeFactory f) { _factory = f; } /** * @since 2.6.2 */ public TypeParser withFactory(TypeFactory f) { return (f == _factory) ? this : new TypeParser(f); } public JavaType parse(String canonical) throws IllegalArgumentException { canonical = canonical.trim(); MyTokenizer tokens = new MyTokenizer(canonical); JavaType type = parseType(tokens); // must be end, now if (tokens.hasMoreTokens()) { throw _problem(tokens, "Unexpected tokens after complete type"); } return type; } protected JavaType parseType(MyTokenizer tokens) throws IllegalArgumentException { if (!tokens.hasMoreTokens()) { throw _problem(tokens, "Unexpected end-of-string"); } Class<?> base = findClass(tokens.nextToken(), tokens); // either end (ok, non generic type), or generics if (tokens.hasMoreTokens()) { String token = tokens.nextToken(); if ("<".equals(token)) { List<JavaType> parameterTypes = parseTypes(tokens); TypeBindings b = TypeBindings.create(base, parameterTypes); return _factory._fromClass(null, base, b); } // can be comma that separates types, or closing '>' tokens.pushBack(token); } return _factory._fromClass(null, base, null); } protected List<JavaType> parseTypes(MyTokenizer tokens) throws IllegalArgumentException { ArrayList<JavaType> types = new ArrayList<JavaType>(); while (tokens.hasMoreTokens()) { types.add(parseType(tokens)); if (!tokens.hasMoreTokens()) break; String token = tokens.nextToken(); if (">".equals(token)) return types; if (!",".equals(token)) { throw _problem(tokens, "Unexpected token '"+token+"', expected ',' or '>')"); } } throw _problem(tokens, "Unexpected end-of-string"); } protected Class<?> findClass(String className, MyTokenizer tokens) { try { return _factory.findClass(className); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } throw _problem(tokens, "Can not locate class '"+className+"', problem: "+e.getMessage()); } } protected IllegalArgumentException _problem(MyTokenizer tokens, String msg) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> = visitor.expectStringFormat(typeHint); if (stringVisitor != null) { Set<String> enums = new LinkedHashSet<String>(); // Use toString()? if ((serializers != null) && serializers.isEnabled(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)) { for (Enum<?> e : _values.enums()) { enums.add(e.toString()); } } else { // No, serialize using name() or explicit overrides for (SerializableString value : _values.values()) { enums.add(value.getValue()); } } stringVisitor.enumTypes(enums); } } /* /********************************************************** /* Helper methods /********************************************************** */ protected final boolean _serializeAsIndex(SerializerProvider serializers) { if (_serializeAsIndex != null) { return _serializeAsIndex.booleanValue(); } return serializers.isEnabled(SerializationFeature.WRITE_ENUMS_USING_INDEX); } /** * Helper method called to check whether */ protected static Boolean _isShapeWrittenUsingIndex(Class<?> enumClass, JsonFormat.Value format, boolean fromClass) { JsonFormat.Shape shape = (format == null) ? null : format.getShape(); if (shape == null) { return null; } if (shape == Shape.ANY || shape == Shape.SCALAR) { // i.e. "default", check dynamically return null; } if (shape == Shape.STRING) { return Boolean.FALSE; } // 01-Oct-2014, tatu: For convenience, consider "as-array" to also mean 'yes, use index') if (shape.isNumeric() || (shape == Shape.ARRAY)) { return Boolean.TRUE; } throw new IllegalArgumentException("Unsupported serialization shape ("+shape+") for Enum "+enumClass.getName() +", not supported as " + (fromClass? "class" : "property") +" annotation"); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>h), _valueHandler, _typeHandler, _asStatic); } @Override public MapType withValueHandler(Object h) { return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType, _valueType, h, _typeHandler, _asStatic); } @Override public MapType withContentValueHandler(Object h) { return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType, _valueType.withValueHandler(h), _valueHandler, _typeHandler, _asStatic); } @Override public MapType withStaticTyping() { if (_asStatic) { return this; } return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType.withStaticTyping(), _valueType.withStaticTyping(), _valueHandler, _typeHandler, true); } @Override public JavaType withContentType(JavaType contentType) { if (_valueType == contentType) { return this; } return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType, contentType, _valueHandler, _typeHandler, _asStatic); } @Override public MapType withKeyType(JavaType keyType) { if (keyType == _keyType) { return this; } return new MapType(_class, _bindings, _superClass, _superInterfaces, keyType, _valueType, _valueHandler, _typeHandler, _asStatic); } @Override public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { return new MapType(rawType, bindings, superClass, superInterfaces, _keyType, _valueType, _valueHandler, _typeHandler, _asStatic); } /* /********************************************************** /* Extended API /********************************************************** */ @Override public MapType withKeyTypeHandler(Object h) { return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType.withTypeHandler(h), _valueType, _valueHandler, _typeHandler, _asStatic); } @Override public MapType withKeyValueHandler(Object h) { return new MapType(_class, _bindings, _superClass, _superInterfaces, _keyType.withValueHandler(h), _valueType, _valueHandler, _typeHandler, _asStatic); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { return "[map type; class "+_class.getName()+", "+_keyType+" -> "+_valueType+"]"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.exc; import java.util.*; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonMappingException; /** * Specialized {@link JsonMappingException} sub-class specifically used * to indicate problems due to encountering a JSON property that could * not be mapped to an Object property (via getter, constructor argument * or field). */ public class UnrecognizedPropertyException extends PropertyBindingException { private static final long serialVersionUID = 1L; public UnrecognizedPropertyException(JsonParser p, String msg, JsonLocation loc, Class<?> referringClass, String propName, Collection<Object> propertyIds) { super(p, msg, loc, referringClass, propName, propertyIds); } /** * @deprecated Since 2.7 */ @Deprecated // since 2.7 public UnrecognizedPropertyException(String msg, JsonLocation loc, Class<?> referringClass, String propName, Collection<Object> propertyIds) { super(msg, loc, referringClass, propName, propertyIds); } /** * Factory method used for constructing instances of this exception type. * * @param p Underlying parser used for reading input being used for data-binding * @param fromObjectOrClass Reference to either instance of problematic type ( * if available), or if not, type itself * @param propertyName Name of unrecognized property * @param propertyIds (optional, null if not available) Set of properties that * type would recognize, if completely known: null if set can not be determined. */ public static UnrecognizedPropertyException from(JsonParser p, Object fromObjectOrClass, String propertyName, Collection<Object> propertyIds) { if (fromObjectOrClass == null) { throw new IllegalArgumentException(); } Class<?> ref; if (fromObjectOrClass instanceof Class<?>) { ref = (Class<?>) fromObjectOrClass; } else { ref = fromObjectOrClass.getClass(); } String msg = "Unrecognized field \""+propertyName+"\" (class "+ref.getName()+"), not marked as ignorable"; UnrecognizedPropertyException e = new UnrecognizedPropertyException(p, msg, p.getCurrentLocation(), ref, propertyName, propertyIds); // but let's also ensure path includes this last (missing) segment e.prependPath(fromObjectOrClass, propertyName); return e; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.PropertyMetadata; import com.fasterxml.jackson.databind.PropertyName; import com.fasterxml.jackson.databind.deser.CreatorProperty; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; /** * For {@link JsonLocation}, we should be able to just implement * {@link ValueInstantiator} (not that explicit one would be very * hard but...) */ public class JsonLocationInstantiator extends ValueInstantiator { @Override public String getValueTypeDesc() { return JsonLocation.class.getName(); } @Override public boolean canCreateFromObjectWith() { return true; } @Override public SettableBeanProperty[] getFromObjectArguments(DeserializationConfig config) { JavaType intType = config.constructType(Integer.TYPE); JavaType longType = config.constructType(Long.TYPE); return new SettableBeanProperty[] { creatorProp("sourceRef", config.constructType(Object.class), 0), creatorProp("byteOffset", longType, 1), creatorProp("charOffset", longType, 2), creatorProp("lineNr", intType, 3), creatorProp("columnNr", intType, 4) }; } private static CreatorProperty creatorProp(String name, JavaType type, int index) { return new CreatorProperty(PropertyName.construct(name), type, null, null, null, null, index, null, PropertyMetadata.STD_REQUIRED); } @Override public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) { return new JsonLocation(args[0], _long(args[1]), _long(args[2]), _int(args[3]), _int(args[4])); } private final static long _long(Object o) { return (o == null) ? 0L : ((Number) o).longValue(); } private final static int _int(Object o) { return (o == null) ? 0 : ((Number) o).intValue(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>; } if (exception == null) { exception = new UnresolvedForwardReference(getParser(), "Unresolved forward references for: "); } Object key = roid.getKey().key; for (Iterator<Referring> iterator = roid.referringProperties(); iterator.hasNext(); ) { Referring referring = iterator.next(); exception.addUnresolvedId(key, referring.getBeanType(), referring.getLocation()); } } if (exception != null) { throw exception; } } /** * Overridable helper method called to try to resolve otherwise unresolvable {@link ReadableObjectId}; * and if this succeeds, return <code>true</code> to indicate problem has been resolved in * some way, so that caller can avoid reporting it as an error. *<p> * Default implementation simply calls {@link ReadableObjectId#tryToResolveUnresolved} and * returns whatever it returns. * * @since 2.6 */ protected boolean tryToResolveUnresolvedObjectId(ReadableObjectId roid) { return roid.tryToResolveUnresolved(this); } /* /********************************************************** /* Abstract methods impls, other factory methods /********************************************************** */ @SuppressWarnings("unchecked") @Override public JsonDeserializer<Object> deserializerInstance(Annotated ann, Object deserDef) throws JsonMappingException { if (deserDef == null) { return null; } JsonDeserializer<?> deser; if (deserDef instanceof JsonDeserializer) { deser = (JsonDeserializer<?>) deserDef; } else { /* Alas, there's no way to force return type of "either class * X or Y" -- need to throw an exception after the fact */ if (!(deserDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned deserializer definition of type "+deserDef.getClass().getName()+"; expected type JsonDeserializer or Class<JsonDeserializer> instead"); } Class<?> deserClass = (Class<?>)deserDef; // there are some known "no class" markers to consider too: if (deserClass == JsonDeserializer.None.class || ClassUtil.isBogusClass(deserClass)) { return null; } if (!JsonDeserializer.class.isAssignableFrom(deserClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName()+"; expected Class<JsonDeserializer>"); } HandlerInstantiator hi = _config.getHandlerInstantiator(); deser = (hi == null) ? null : hi.deserializerInstance(_config, ann, deserClass); if (deser == null) { deser = (JsonDeserializer<?>) ClassUtil.createInstance(deserClass, _config.canOverrideAccessModifiers()); } } // First: need to resolve if (deser instanceof ResolvableDeserializer) { ((ResolvableDeserializer)

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> deser).resolve(this); } return (JsonDeserializer<Object>) deser; } @Override public final KeyDeserializer keyDeserializerInstance(Annotated ann, Object deserDef) throws JsonMappingException { if (deserDef == null) { return null; } KeyDeserializer deser; if (deserDef instanceof KeyDeserializer) { deser = (KeyDeserializer) deserDef; } else { if (!(deserDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned key deserializer definition of type " +deserDef.getClass().getName() +"; expected type KeyDeserializer or Class<KeyDeserializer> instead"); } Class<?> deserClass = (Class<?>)deserDef; // there are some known "no class" markers to consider too: if (deserClass == KeyDeserializer.None.class || ClassUtil.isBogusClass(deserClass)) { return null; } if (!KeyDeserializer.class.isAssignableFrom(deserClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName() +"; expected Class<KeyDeserializer>"); } HandlerInstantiator hi = _config.getHandlerInstantiator(); deser = (hi == null) ? null : hi.keyDeserializerInstance(_config, ann, deserClass); if (deser == null) { deser = (KeyDeserializer) ClassUtil.createInstance(deserClass, _config.canOverrideAccessModifiers()); } } // First: need to resolve if (deser instanceof ResolvableDeserializer) { ((ResolvableDeserializer) deser).resolve(this); } return deser; } /* /********************************************************** /* Extended API /********************************************************** */ /** * Fluent factory method used for constructing a blueprint instance * with different factory */ public abstract DefaultDeserializationContext with(DeserializerFactory factory); /** * Method called to create actual usable per-deserialization * context instance. */ public abstract DefaultDeserializationContext createInstance( DeserializationConfig config, JsonParser jp, InjectableValues values); /* /********************************************************** /* And then the concrete implementation class /********************************************************** */ /** * Actual full concrete implementation */ public final static class Impl extends DefaultDeserializationContext { private static final long serialVersionUID = 1L; /** * Default constructor for a blueprint object, which will use the standard * {@link DeserializerCache}, given factory. */ public Impl(DeserializerFactory df) { super(df, null); } protected Impl(Impl src, DeserializationConfig config, JsonParser jp, InjectableValues values) { super(src, config, jp, values); } protected Impl(Impl src) { super(src); } protected Impl(Impl src, DeserializerFactory factory) { super(src, factory); } @Override public DefaultDeserializationContext copy() {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Handler) { return this; } return new ReferenceType(_class, _bindings, _superClass, _superInterfaces, _referencedType, _valueHandler, h, _asStatic); } @Override public ReferenceType withContentTypeHandler(Object h) { if (h == _referencedType.<Object>getTypeHandler()) { return this; } return new ReferenceType(_class, _bindings, _superClass, _superInterfaces, _referencedType.withTypeHandler(h), _valueHandler, _typeHandler, _asStatic); } @Override public ReferenceType withValueHandler(Object h) { if (h == _valueHandler) { return this; } return new ReferenceType(_class, _bindings, _superClass, _superInterfaces, _referencedType, h, _typeHandler,_asStatic); } @Override public ReferenceType withContentValueHandler(Object h) { if (h == _referencedType.<Object>getValueHandler()) { return this; } JavaType refdType = _referencedType.withValueHandler(h); return new ReferenceType(_class, _bindings, _superClass, _superInterfaces, refdType, _valueHandler, _typeHandler, _asStatic); } @Override public ReferenceType withStaticTyping() { if (_asStatic) { return this; } return new ReferenceType(_class, _bindings, _superClass, _superInterfaces, _referencedType.withStaticTyping(), _valueHandler, _typeHandler, true); } @Override public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { return new ReferenceType(rawType, _bindings, superClass, superInterfaces, _referencedType, _valueHandler, _typeHandler, _asStatic); } @Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); sb.append('<'); sb.append(_referencedType.toCanonical()); return sb.toString(); } /* /********************************************************** /* Narrow/widen /********************************************************** */ @Override @Deprecated // since 2.7 protected JavaType _narrow(Class<?> subclass) { // Should we check that there is a sub-class relationship? return new ReferenceType(subclass, _bindings, _superClass, _superInterfaces, _referencedType, _valueHandler, _typeHandler, _asStatic); } /* /********************************************************** /* Public API overrides /********************************************************** */ @Override public JavaType getContentType() { return _referencedType; } @Override public JavaType getReferencedType() { return _referencedType; } @Override public boolean isReferenceType() { return true; } @Override

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> public StringBuilder getErasedSignature(StringBuilder sb) { return _classSignature(_class, sb, true); } @Override public StringBuilder getGenericSignature(StringBuilder sb) { _classSignature(_class, sb, false); sb.append('<'); sb = _referencedType.getGenericSignature(sb); sb.append(">;"); return sb; } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { return new StringBuilder(40) .append("[reference type, class ") .append(buildCanonicalName()) .append('<') .append(_referencedType) .append('>') .append(']') .toString(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; ReferenceType other = (ReferenceType) o; if (other._class != _class) return false; // Otherwise actually mostly worry about referenced type return _referencedType.equals(other._referencedType); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> AnnotatedMember member) { return new SimpleBeanPropertyDefinition(member, PropertyName.construct(member.getName()), (config == null) ? null : config.getAnnotationIntrospector(), null, EMPTY_INCLUDE); } /** * @deprecated Since 2.5 */ @Deprecated public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, String name) { return new SimpleBeanPropertyDefinition(member, PropertyName.construct(name), (config == null) ? null : config.getAnnotationIntrospector(), null, EMPTY_INCLUDE); } /** * @since 2.5 */ public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name) { return construct(config, member, name, null, EMPTY_INCLUDE); } /** * @since 2.5 */ public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Include inclusion) { return new SimpleBeanPropertyDefinition(member, name, (config == null) ? null : config.getAnnotationIntrospector(), metadata, inclusion); } /** * @since 2.7 */ public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Value inclusion) { return new SimpleBeanPropertyDefinition(member, name, (config == null) ? null : config.getAnnotationIntrospector(), metadata, inclusion); } /* /********************************************************** /* Fluent factories /********************************************************** */ // Note: removed from base class in 2.6; left here until 2.7 @Deprecated // since 2.3 (remove in 2.7) public BeanPropertyDefinition withName(String newName) { return withSimpleName(newName); } @Override public BeanPropertyDefinition withSimpleName(String newName) { if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) { return this; } return new SimpleBeanPropertyDefinition(_member, new PropertyName(newName), _introspector, _metadata, _inclusion); } @Override public BeanPropertyDefinition withName(PropertyName newName) { if (_fullName.equals(newName)) { return this; } return new SimpleBeanPropertyDefinition(_member, newName, _introspector, _metadata, _inclusion); } /** * @since 2.5 */ public BeanPropertyDefinition withMetadata(PropertyMetadata metadata) { if (metadata.equals(_metadata)) { return this; } return new SimpleBeanPropertyDefinition(_member, _fullName, _introspector, metadata, _inclusion); } /** * @since 2.5 */ public Bean

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>PropertyDefinition withInclusion(JsonInclude.Value inclusion) { if (_inclusion == inclusion) { return this; } return new SimpleBeanPropertyDefinition(_member, _fullName, _introspector, _metadata, inclusion); } /* /********************************************************** /* Basic property information, name, type /********************************************************** */ @Override public String getName() { return _fullName.getSimpleName(); } @Override public PropertyName getFullName() { return _fullName; } @Override public boolean hasName(PropertyName name) { return _fullName.equals(name); } @Override public String getInternalName() { return getName(); } @Override public PropertyName getWrapperName() { return ((_introspector == null) && (_member != null)) ? null : _introspector.findWrapperName(_member); } // hmmh. what should we claim here? @Override public boolean isExplicitlyIncluded() { return false; } @Override public boolean isExplicitlyNamed() { return false; } /** * We will indicate that property is optional, since there is nothing * to indicate whether it might be required. */ @Override public PropertyMetadata getMetadata() { return _metadata; } @Override public JsonInclude.Value findInclusion() { return _inclusion; } /* /********************************************************** /* Access to accessors (fields, methods etc) /********************************************************** */ @Override public boolean hasGetter() { return (getGetter() != null); } @Override public boolean hasSetter() { return (getSetter() != null); } @Override public boolean hasField() { return (_member instanceof AnnotatedField); } @Override public boolean hasConstructorParameter() { return (_member instanceof AnnotatedParameter); } @Override public AnnotatedMethod getGetter() { if ((_member instanceof AnnotatedMethod) && ((AnnotatedMethod) _member).getParameterCount() == 0) { return (AnnotatedMethod) _member; } return null; } @Override public AnnotatedMethod getSetter() { if ((_member instanceof AnnotatedMethod) && ((AnnotatedMethod) _member).getParameterCount() == 1) { return (AnnotatedMethod) _member; } return null; } @Override public AnnotatedField getField() { return (_member instanceof AnnotatedField) ? (AnnotatedField) _member : null; } @Override public AnnotatedParameter getConstructorParameter() { return (_member instanceof AnnotatedParameter) ? (AnnotatedParameter) _member : null; } @Override public Iterator<AnnotatedParameter> getConstructorParameters() { AnnotatedParameter param = getConstructorParameter(); if (param == null) { return ClassUtil.emptyIterator(); } return Collections.singleton(param).iterator(); } /** * Method used to find accessor (getter, field to access

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Config<?> config, JavaType type, AnnotatedClass classDef, List<BeanPropertyDefinition> props) { super(type); _propCollector = null; _config = config; _annotationIntrospector = (_config == null) ? null : _config.getAnnotationIntrospector(); _classInfo = classDef; _properties = props; } protected BasicBeanDescription(POJOPropertiesCollector coll) { this(coll, coll.getType(), coll.getClassDef()); _objectIdInfo = coll.getObjectIdInfo(); } /** * Factory method to use for constructing an instance to use for building * deserializers. */ public static BasicBeanDescription forDeserialization(POJOPropertiesCollector coll) { return new BasicBeanDescription(coll); } /** * Factory method to use for constructing an instance to use for building * serializers. */ public static BasicBeanDescription forSerialization(POJOPropertiesCollector coll) { return new BasicBeanDescription(coll); } /** * Factory method to use for constructing an instance to use for purposes * other than building serializers or deserializers; will only have information * on class, not on properties. */ public static BasicBeanDescription forOtherUse(MapperConfig<?> config, JavaType type, AnnotatedClass ac) { return new BasicBeanDescription(config, type, ac, Collections.<BeanPropertyDefinition>emptyList()); } protected List<BeanPropertyDefinition> _properties() { if (_properties == null) { _properties = _propCollector.getProperties(); } return _properties; } /* /********************************************************** /* Limited modifications by core databind functionality /********************************************************** */ /** * Method that can be used to prune unwanted properties, during * construction of serializers and deserializers. * Use with utmost care, if at all... * * @since 2.1 */ public boolean removeProperty(String propName) { Iterator<BeanPropertyDefinition> it = _properties().iterator(); while (it.hasNext()) { BeanPropertyDefinition prop = it.next(); if (prop.getName().equals(propName)) { it.remove(); return true; } } return false; } public boolean addProperty(BeanPropertyDefinition def) { // first: ensure we do not have such property if (hasProperty(def.getFullName())) { return false; } _properties().add(def); return true; } /** * @since 2.6 */ public boolean hasProperty(PropertyName name) { return findProperty(name) != null; } /** * @since 2.6 */ public BeanPropertyDefinition findProperty(PropertyName name) { for (BeanPropertyDefinition prop : _properties()) { if (prop.hasName(name)) { return prop; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> return null; } /* /********************************************************** /* Simple accessors from BeanDescription /********************************************************** */ @Override public AnnotatedClass getClassInfo() { return _classInfo; } @Override public ObjectIdInfo getObjectIdInfo() { return _objectIdInfo; } @Override public List<BeanPropertyDefinition> findProperties() { return _properties(); } @Override public AnnotatedMethod findJsonValueMethod() { return (_propCollector == null) ? null : _propCollector.getJsonValueMethod(); } @Override public Set<String> getIgnoredPropertyNames() { Set<String> ign = (_propCollector == null) ? null : _propCollector.getIgnoredPropertyNames(); if (ign == null) { return Collections.emptySet(); } return ign; } @Override public boolean hasKnownClassAnnotations() { return _classInfo.hasAnnotations(); } @Override public Annotations getClassAnnotations() { return _classInfo.getAnnotations(); } @Override @Deprecated // since 2.7 public TypeBindings bindingsForBeanType() { return _type.getBindings(); } @Override public JavaType resolveType(java.lang.reflect.Type jdkType) { if (jdkType == null) { return null; } return _config.getTypeFactory().constructType(jdkType, _type.getBindings()); } @Override public AnnotatedConstructor findDefaultConstructor() { return _classInfo.getDefaultConstructor(); } @Override public AnnotatedMethod findAnySetter() throws IllegalArgumentException { AnnotatedMethod anySetter = (_propCollector == null) ? null : _propCollector.getAnySetterMethod(); if (anySetter != null) { /* Also, let's be somewhat strict on how field name is to be * passed; String, Object make sense, others not * so much. */ /* !!! 18-May-2009, tatu: how about enums? Can add support if * requested; easy enough for devs to add support within * method. */ Class<?> type = anySetter.getRawParameterType(0); if (type != String.class && type != Object.class) { throw new IllegalArgumentException("Invalid 'any-setter' annotation on method "+anySetter.getName()+"(): first argument not of type String or Object, but "+type.getName()); } } return anySetter; } @Override public Map<Object, AnnotatedMember> findInjectables() { if (_propCollector != null) { return _propCollector.getInjectables(); } return Collections.emptyMap(); } @Override public List<AnnotatedConstructor> getConstructors() { return _classInfo.getConstructors(); } @Override public Object instantiateBean(boolean fixAccess) { AnnotatedConstructor ac = _

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>classInfo.getDefaultConstructor(); if (ac == null) { return null; } if (fixAccess) { ac.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } try { return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e; while (t.getCause() != null) { t = t.getCause(); } if (t instanceof Error) throw (Error) t; if (t instanceof RuntimeException) throw (RuntimeException) t; throw new IllegalArgumentException("Failed to instantiate bean of type "+_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") "+t.getMessage(), t); } } /* /********************************************************** /* Simple accessors, extended /********************************************************** */ @Override public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes) { return _classInfo.findMethod(name, paramTypes); } /* /********************************************************** /* General per-class annotation introspection /********************************************************** */ @Override public JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue) { if (_annotationIntrospector != null) { JsonFormat.Value v = _annotationIntrospector.findFormat(_classInfo); if (v != null) { return v; } } return defValue; } /* /********************************************************** /* Introspection for serialization /********************************************************** */ @Override public Converter<Object,Object> findSerializationConverter() { if (_annotationIntrospector == null) { return null; } return _createConverter(_annotationIntrospector.findSerializationConverter(_classInfo)); } /** * Method for determining whether null properties should be written * out for a Bean of introspected type. This is based on global * feature (lowest priority, passed as argument) * and per-class annotation (highest priority). */ @Override public JsonInclude.Value findPropertyInclusion(JsonInclude.Value defValue) { if (_annotationIntrospector != null) { JsonInclude.Value incl = _annotationIntrospector.findPropertyInclusion(_classInfo); if (incl != null) { return defValue.withOverrides(incl); } } return defValue; } /** * Method used to locate the method of introspected class that * implements {@link com.fasterxml.jackson.annotation.JsonAnyGetter}. * If no such method exists null is returned. * If more than one are found, an exception is thrown. */ @Override public AnnotatedMember findAnyGetter() throws IllegalArgumentException { AnnotatedMember anyGetter = (_propCollector == null) ? null : _propCollector.getAnyGetter(); if (anyGetter != null) { /* For now let's require a Map

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>; in future can add support for other * types like perhaps Iterable<Map.Entry>? */ Class<?> type = anyGetter.getRawType(); if (!Map.class.isAssignableFrom(type)) { throw new IllegalArgumentException("Invalid 'any-getter' annotation on method "+anyGetter.getName()+"(): return type is not instance of java.util.Map"); } } return anyGetter; } @Override public Map<String,AnnotatedMember> findBackReferenceProperties() { HashMap<String,AnnotatedMember> result = null; // boolean hasIgnored = (_ignoredPropertyNames != null); for (BeanPropertyDefinition property : _properties()) { /* 23-Sep-2014, tatu: As per [Databind#426], we _should_ try to avoid * calling accessor, as it triggers exception from seeming conflict. * But the problem is that _ignoredPropertyNames here only contains * ones ignored on per-property annotations, but NOT class annotations... * so commented out part does not work, alas */ /* if (hasIgnored && _ignoredPropertyNames.contains(property.getName())) { continue; } */ AnnotatedMember am = property.getMutator(); if (am == null) { continue; } AnnotationIntrospector.ReferenceProperty refDef = _annotationIntrospector.findReferenceType(am); if (refDef != null && refDef.isBackReference()) { if (result == null) { result = new HashMap<String,AnnotatedMember>(); } String refName = refDef.getName(); if (result.put(refName, am) != null) { throw new IllegalArgumentException("Multiple back-reference properties with name '"+refName+"'"); } } } return result; } /* /********************************************************** /* Introspection for deserialization, factories /********************************************************** */ @Override public List<AnnotatedMethod> getFactoryMethods() { // must filter out anything that clearly is not a factory method List<AnnotatedMethod> candidates = _classInfo.getStaticMethods(); if (candidates.isEmpty()) { return candidates; } ArrayList<AnnotatedMethod> result = new ArrayList<AnnotatedMethod>(); for (AnnotatedMethod am : candidates) { if (isFactoryMethod(am)) { result.add(am); } } return result; } @Override public Constructor<?> findSingleArgConstructor(Class<?>... argTypes) { for (AnnotatedConstructor ac : _classInfo.getConstructors()) { // This list is already filtered to only include accessible /* (note: for now this is a redundant check; but in future * that may change; thus leaving here for now) */ if (ac.getParameterCount() == 1) { Class<?> actArg = ac.getRawParameterType(0); for (Class

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS><?> expArg : argTypes) { if (expArg == actArg) { return ac.getAnnotated(); } } } } return null; } @Override public Method findFactoryMethod(Class<?>... expArgTypes) { // So, of all single-arg static methods: for (AnnotatedMethod am : _classInfo.getStaticMethods()) { if (isFactoryMethod(am)) { // And must take one of expected arg types (or supertype) Class<?> actualArgType = am.getRawParameterType(0); for (Class<?> expArgType : expArgTypes) { // And one that matches what we would pass in if (actualArgType.isAssignableFrom(expArgType)) { return am.getAnnotated(); } } } } return null; } protected boolean isFactoryMethod(AnnotatedMethod am) { /* First: return type must be compatible with the introspected class * (i.e. allowed to be sub-class, although usually is the same * class) */ Class<?> rt = am.getRawReturnType(); if (!getBeanClass().isAssignableFrom(rt)) { return false; } /* Also: must be a recognized factory method, meaning: * (a) marked with @JsonCreator annotation, or * (b) "valueOf" (at this point, need not be public) */ if (_annotationIntrospector.hasCreatorAnnotation(am)) { return true; } final String name = am.getName(); if ("valueOf".equals(name)) { return true; } // [Issue#208] Also accept "fromString()", if takes String or CharSequence if ("fromString".equals(name)) { if (1 == am.getParameterCount()) { Class<?> cls = am.getRawParameterType(0); if (cls == String.class || CharSequence.class.isAssignableFrom(cls)) { return true; } } } return false; } /** * @deprecated Since 2.4, use <code>findCreatorParameterNames()</code> instead. */ @Deprecated public List<String> findCreatorPropertyNames() { List<PropertyName> params = findCreatorParameterNames(); if (params.isEmpty()) { return Collections.emptyList(); } List<String> result = new ArrayList<String>(params.size()); for (PropertyName name : params) { result.add(name.getSimpleName()); } return result; } /** * @deprecated Since 2.5, does not seem to be used at all. */ @Deprecated public List<PropertyName> findCreatorParameterNames() { for (int i = 0; i < 2; ++i) { List<? extends AnnotatedWithParams> l = (i == 0) ? getConstructors() : getFactoryMethods(); for (

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>AnnotatedWithParams creator : l) { int argCount = creator.getParameterCount(); if (argCount < 1) continue; PropertyName name = _findCreatorPropertyName(creator.getParameter(0)); if (name == null || name.isEmpty()) { continue; } List<PropertyName> names = new ArrayList<PropertyName>(); names.add(name); for (int p = 1; p < argCount; ++p) { name = _findCreatorPropertyName(creator.getParameter(p)); names.add(name); } return names; } } return Collections.emptyList(); } protected PropertyName _findCreatorPropertyName(AnnotatedParameter param) { PropertyName name = _annotationIntrospector.findNameForDeserialization(param); if (name == null || name.isEmpty()) { String str = _annotationIntrospector.findImplicitPropertyName(param); if (str != null && !str.isEmpty()) { name = PropertyName.construct(str); } } return name; } /* /********************************************************** /* Introspection for deserialization, other /********************************************************** */ @Override public Class<?> findPOJOBuilder() { return (_annotationIntrospector == null) ? null : _annotationIntrospector.findPOJOBuilder(_classInfo); } @Override public JsonPOJOBuilder.Value findPOJOBuilderConfig() { return (_annotationIntrospector == null) ? null : _annotationIntrospector.findPOJOBuilderConfig(_classInfo); } @Override public Converter<Object,Object> findDeserializationConverter() { if (_annotationIntrospector == null) { return null; } return _createConverter(_annotationIntrospector.findDeserializationConverter(_classInfo)); } @Override public String findClassDescription() { return (_annotationIntrospector == null) ? null : _annotationIntrospector.findClassDescription(_classInfo); } /* /********************************************************** /* Helper methods for field introspection /********************************************************** */ /** * @param ignoredProperties (optional) names of properties to ignore; * any fields that would be recognized as one of these properties * is ignored. * @param forSerialization If true, will collect serializable property * fields; if false, deserializable * * @return Ordered Map with logical property name as key, and * matching field as value. * * @deprecated Since 2.7.2, does not seem to be used? */ @Deprecated public LinkedHashMap<String,AnnotatedField> _findPropertyFields( Collection<String> ignoredProperties, boolean forSerialization) { LinkedHashMap<String,AnnotatedField> results = new LinkedHashMap<String,AnnotatedField>(); for (BeanPropertyDefinition property : _properties()) { AnnotatedField f = property.getField(); if (f !=

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> null) { String name = property.getName(); if (ignoredProperties != null) { if (ignoredProperties.contains(name)) { continue; } } results.put(name, f); } } return results; } /* /********************************************************** /* Helper methods, other /********************************************************** */ @SuppressWarnings("unchecked") public Converter<Object,Object> _createConverter(Object converterDef) { if (converterDef == null) { return null; } if (converterDef instanceof Converter<?,?>) { return (Converter<Object,Object>) converterDef; } if (!(converterDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned Converter definition of type " +converterDef.getClass().getName()+"; expected type Converter or Class<Converter> instead"); } Class<?> converterClass = (Class<?>)converterDef; // there are some known "no class" markers to consider too: if (converterClass == Converter.None.class || ClassUtil.isBogusClass(converterClass)) { return null; } if (!Converter.class.isAssignableFrom(converterClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class " +converterClass.getName()+"; expected Class<Converter>"); } HandlerInstantiator hi = _config.getHandlerInstantiator(); Converter<?,?> conv = (hi == null) ? null : hi.converterInstance(_config, _classInfo, converterClass); if (conv == null) { conv = (Converter<?,?>) ClassUtil.createInstance(converterClass, _config.canOverrideAccessModifiers()); } return (Converter<Object,Object>) conv; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>propertyIndex; _viewMatcher = src._viewMatcher; } /** * Fluent factory method for constructing and returning a new instance * with specified value deserializer. * Note that this method should NOT change configuration of this instance. * * @param deser Deserializer to assign to the new property instance * * @return Newly constructed instance, if value deserializer differs from the * one used for this instance; or 'this' if not. */ public abstract SettableBeanProperty withValueDeserializer(JsonDeserializer<?> deser); /** * Fluent factory method for constructing and returning a new instance * with specified property name. * Note that this method should NOT change configuration of this instance. * * @param newName Name to use for the new instance. * * @return Newly constructed instance, if property name differs from the * one used for this instance; or 'this' if not. */ public abstract SettableBeanProperty withName(PropertyName newName); /** * @since 2.3 */ public SettableBeanProperty withSimpleName(String simpleName) { PropertyName n = (_propName == null) ? new PropertyName(simpleName) : _propName.withSimpleName(simpleName); return (n == _propName) ? this : withName(n); } @Deprecated // since 2.3 -- use 'withSimpleName' instead if need be public SettableBeanProperty withName(String simpleName) { return withName(new PropertyName(simpleName)); } public void setManagedReferenceName(String n) { _managedReferenceName = n; } public void setObjectIdInfo(ObjectIdInfo objectIdInfo) { _objectIdInfo = objectIdInfo; } public void setViews(Class<?>[] views) { if (views == null) { _viewMatcher = null; } else { _viewMatcher = ViewMatcher.construct(views); } } /** * Method used to assign index for property. */ public void assignIndex(int index) { if (_propertyIndex != -1) { throw new IllegalStateException("Property '"+getName()+"' already had index ("+_propertyIndex+"), trying to assign "+index); } _propertyIndex = index; } /* /********************************************************** /* BeanProperty impl /********************************************************** */ @Override public final String getName() { return _propName.getSimpleName(); } @Override public PropertyName getFullName() { return _propName; } @Override public JavaType getType() { return _type; } @Override public PropertyName getWrapperName() { return _wrapperName; } @Override public abstract AnnotatedMember getMember(); @Override public abstract <A extends Annotation> A getAnnotation(Class<A> acls); @Override public <A extends Annotation> A getContext

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Return(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException; /** * Method called to assign given value to this property, on * specified Object. *<p> * Note: this is an optional operation, not supported by all * implementations, creator-backed properties for example do not * support this method. */ public abstract void set(Object instance, Object value) throws IOException; /** * Method called to assign given value to this property, on * specified Object, and return whatever delegating accessor * returned (if anything) *<p> * Note: this is an optional operation, not supported by all * implementations, creator-backed properties for example do not * support this method. */ public abstract Object setAndReturn(Object instance, Object value) throws IOException; /** * This method is needed by some specialized bean deserializers, * and also called by some {@link #deserializeAndSet} implementations. *<p> * Pre-condition is that passed parser must point to the first token * that should be consumed to produce the value (the only value for * scalars, multiple for Objects and Arrays). *<p> * Note that this method is final for performance reasons: to override * functionality you must override other methods that call this method; * this method should also not be called directly unless you really know * what you are doing (and probably not even then). */ public final Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NULL) { return _valueDeserializer.getNullValue(ctxt); } if (_valueTypeDeserializer != null) { return _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer); } return _valueDeserializer.deserialize(p, ctxt); } /* /********************************************************** /* Helper methods /********************************************************** */ /** * Method that takes in exception of any type, and casts or wraps it * to an IOException or its subclass. */ protected void _throwAsIOE(JsonParser p, Exception e, Object value) throws IOException { if (e instanceof IllegalArgumentException) { String actType = (value == null) ? "[NULL]" : value.getClass().getName(); StringBuilder msg = new StringBuilder("Problem deserializing property '").append(getName()); msg.append("' (expected type: ").append(getType()); msg.append("; actual type: ").append(actType).append(")"); String origMsg = e.getMessage(); if (origMsg != null) { msg.append(", problem: ").append(origMsg); } else { msg.append(" (no error message provided)"); } throw JsonMappingException.from(p, msg.toString(), e); } _throwAsIOE(p, e); } /** *

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> @since 2.7 */ protected IOException _throwAsIOE(JsonParser p, Exception e) throws IOException { if (e instanceof IOException) { throw (IOException) e; } if (e instanceof RuntimeException) { throw (RuntimeException) e; } // let's wrap the innermost problem Throwable th = e; while (th.getCause() != null) { th = th.getCause(); } throw JsonMappingException.from(p, th.getMessage(), th); } @Deprecated // since 2.7 protected IOException _throwAsIOE(Exception e) throws IOException { return _throwAsIOE((JsonParser) null, e); } // 10-Oct-2015, tatu: _Should_ be deprecated, too, but its remaining // callers can not actually provide a JsonParser protected void _throwAsIOE(Exception e, Object value) throws IOException { _throwAsIOE((JsonParser) null, e, value); } @Override public String toString() { return "[property '"+getName()+"']"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.Constructor; import java.lang.reflect.Method; /** * Helper class needed to be able to efficiently access class * member functions ({@link Method}s and {@link Constructor}s) * in {@link java.util.Map}s. */ public final class MemberKey { final static Class<?>[] NO_CLASSES = new Class<?>[0]; final String _name; final Class<?>[] _argTypes; public MemberKey(Method m) { this(m.getName(), m.getParameterTypes()); } public MemberKey(Constructor<?> ctor) { this("", ctor.getParameterTypes()); } public MemberKey(String name, Class<?>[] argTypes) { _name = name; _argTypes = (argTypes == null) ? NO_CLASSES : argTypes; } @Override public String toString() { return _name + "(" + _argTypes.length+"-args)"; } @Override public int hashCode() { return _name.hashCode() + _argTypes.length; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) { return false; } MemberKey other = (MemberKey) o; if (!_name.equals(other._name)) { return false; } Class<?>[] otherArgs = other._argTypes; int len = _argTypes.length; if (otherArgs.length != len) { return false; } for (int i = 0; i < len; ++i) { Class<?> type1 = otherArgs[i]; Class<?> type2 = _argTypes[i]; if (type1 == type2) { continue; } /* 23-Feb-2009, tatu: Are there any cases where we would have to * consider some narrowing conversions or such? For now let's * assume exact type match is enough */ /* 07-Apr-2009, tatu: Indeed there are (see [JACKSON-97]). * This happens with generics when a bound is specified. * I hope this works; check here must be transitive */ /* 14-Oct-2014, tatu: No, doing that is wrong. Conflicts may (and will) be * handled at a later point; trying to change definition of equality * will just cause problems like [jackson-core#158] */ /* if (type1.isAssignableFrom(type2) || type2.isAssignableFrom(type1)) { continue; } */ return false; } return true

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> // Then: well-known proxy (etc) classes if (Proxy.isProxyClass(type)) { return true; } */ String name = type.getName(); // Hibernate uses proxies heavily as well: if (name.startsWith("net.sf.cglib.proxy.") || name.startsWith("org.hibernate.proxy.")) { return true; } // Not one of known proxies, nope: return false; } /** * Helper method that checks if given class is a concrete one; * that is, not an interface or abstract class. */ public static boolean isConcrete(Class<?> type) { int mod = type.getModifiers(); return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0; } public static boolean isConcrete(Member member) { int mod = member.getModifiers(); return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0; } public static boolean isCollectionMapOrArray(Class<?> type) { if (type.isArray()) return true; if (Collection.class.isAssignableFrom(type)) return true; if (Map.class.isAssignableFrom(type)) return true; return false; } /* /********************************************************** /* Type name handling methods /********************************************************** */ /** * Helper method used to construct appropriate description * when passed either type (Class) or an instance; in latter * case, class of instance is to be used. */ public static String getClassDescription(Object classOrInstance) { if (classOrInstance == null) { return "unknown"; } Class<?> cls = (classOrInstance instanceof Class<?>) ? (Class<?>) classOrInstance : classOrInstance.getClass(); return cls.getName(); } /* /********************************************************** /* Class loading /********************************************************** */ /** * @deprecated Since 2.6, use method in {@link com.fasterxml.jackson.databind.type.TypeFactory}. */ @Deprecated public static Class<?> findClass(String className) throws ClassNotFoundException { // [JACKSON-597]: support primitive types (and void) if (className.indexOf('.') < 0) { if ("int".equals(className)) return Integer.TYPE; if ("long".equals(className)) return Long.TYPE; if ("float".equals(className)) return Float.TYPE; if ("double".equals(className)) return Double.TYPE; if ("boolean".equals(className)) return Boolean.TYPE; if ("byte".equals(className)) return Byte.TYPE; if ("char".equals(className)) return Character.TYPE; if ("short".equals(className)) return Short.TYPE; if ("void".equals(className)) return Void.TYPE; } // Two-phase lookup: first using context ClassLoader; then default Throwable

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Method that will wrap 't' as an {@link IllegalArgumentException} (and with * specified message) if it * is a checked exception; otherwise (runtime exception or error) throw as is */ public static void throwAsIAE(Throwable t, String msg) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof Error) { throw (Error) t; } throw new IllegalArgumentException(msg, t); } /** * Method that will locate the innermost exception for given Throwable; * and then wrap it as an {@link IllegalArgumentException} if it * is a checked exception; otherwise (runtime exception or error) throw as is */ public static void unwrapAndThrowAsIAE(Throwable t) { throwAsIAE(getRootCause(t)); } /** * Method that will locate the innermost exception for given Throwable; * and then wrap it as an {@link IllegalArgumentException} if it * is a checked exception; otherwise (runtime exception or error) throw as is */ public static void unwrapAndThrowAsIAE(Throwable t, String msg) { throwAsIAE(getRootCause(t), msg); } /* /********************************************************** /* Instantiation /********************************************************** */ /** * Method that can be called to try to create an instantiate of * specified type. Instantiation is done using default no-argument * constructor. * * @param canFixAccess Whether it is possible to try to change access * rights of the default constructor (in case it is not publicly * accessible) or not. * * @throws IllegalArgumentException If instantiation fails for any reason; * except for cases where constructor throws an unchecked exception * (which will be passed as is) */ public static <T> T createInstance(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { Constructor<T> ctor = findConstructor(cls, canFixAccess); if (ctor == null) { throw new IllegalArgumentException("Class "+cls.getName()+" has no default (no arg) constructor"); } try { return ctor.newInstance(); } catch (Exception e) { ClassUtil.unwrapAndThrowAsIAE(e, "Failed to instantiate class "+cls.getName()+", problem: "+e.getMessage()); return null; } } public static <T> Constructor<T> findConstructor(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException { try { Constructor<T> ctor = cls.getDeclaredConstructor(); if (canFixAccess) { checkAndFixAccess(ctor); } else { // Has to be public... if (!Modifier.isPublic(ctor.getModifiers())) { throw new IllegalArgumentException("Default constructor for "+cls.getName()+" is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type"); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } return ctor; } catch (NoSuchMethodException e) { ; } catch (Exception e) { ClassUtil.unwrapAndThrowAsIAE(e, "Failed to find default constructor of class "+cls.getName()+", problem: "+e.getMessage()); } return null; } /* /********************************************************** /* Primitive type support /********************************************************** */ /** * Helper method used to get default value for wrappers used for primitive types * (0 for Integer etc) */ public static Object defaultValue(Class<?> cls) { if (cls == Integer.TYPE) { return Integer.valueOf(0); } if (cls == Long.TYPE) { return Long.valueOf(0L); } if (cls == Boolean.TYPE) { return Boolean.FALSE; } if (cls == Double.TYPE) { return Double.valueOf(0.0); } if (cls == Float.TYPE) { return Float.valueOf(0.0f); } if (cls == Byte.TYPE) { return Byte.valueOf((byte) 0); } if (cls == Short.TYPE) { return Short.valueOf((short) 0); } if (cls == Character.TYPE) { return '\0'; } throw new IllegalArgumentException("Class "+cls.getName()+" is not a primitive type"); } /** * Helper method for finding wrapper type for given primitive type (why isn't * there one in JDK?) */ public static Class<?> wrapperType(Class<?> primitiveType) { if (primitiveType == Integer.TYPE) { return Integer.class; } if (primitiveType == Long.TYPE) { return Long.class; } if (primitiveType == Boolean.TYPE) { return Boolean.class; } if (primitiveType == Double.TYPE) { return Double.class; } if (primitiveType == Float.TYPE) { return Float.class; } if (primitiveType == Byte.TYPE) { return Byte.class; } if (primitiveType == Short.TYPE) { return Short.class; } if (primitiveType == Character.TYPE) { return Character.class; } throw new IllegalArgumentException("Class "+primitiveType.getName()+" is not a primitive type"); } /** * Method that can be used to find primitive type for given class if (but only if) * it is either wrapper type or primitive type; returns `null` if type is neither. * * @since 2.7 */ public static Class<?> primitiveType(Class<?> type) { if (type.isPrimitive()) { return type; } if (type == Integer.class) { return Integer.TYPE; } if (type == Long.class) { return Long.TYPE; } if (type

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> == Boolean.class) { return Boolean.TYPE; } if (type == Double.class) { return Double.TYPE; } if (type == Float.class) { return Float.TYPE; } if (type == Byte.class) { return Byte.TYPE; } if (type == Short.class) { return Short.TYPE; } if (type == Character.class) { return Character.TYPE; } return null; } /* /********************************************************** /* Access checking/handling methods /********************************************************** */ /** * Equivalent to call: *<pre> * checkAndFixAccess(member, false); *</pre> * * @deprecated Since 2.7 call variant that takes boolean flag. */ @Deprecated public static void checkAndFixAccess(Member member) { checkAndFixAccess(member, false); } /** * Method that is called if a {@link Member} may need forced access, * to force a field, method or constructor to be accessible: this * is done by calling {@link AccessibleObject#setAccessible(boolean)}. * * @param member Accessor to call <code>setAccessible()</code> on. * @param force Whether to always try to make accessor accessible (true), * or only if needed as per access rights (false) * * @since 2.7 */ public static void checkAndFixAccess(Member member, boolean force) { // We know all members are also accessible objects... AccessibleObject ao = (AccessibleObject) member; /* 14-Jan-2009, tatu: It seems safe and potentially beneficial to * always to make it accessible (latter because it will force * skipping checks we have no use for...), so let's always call it. */ try { if (force || (!Modifier.isPublic(member.getModifiers()) || !Modifier.isPublic(member.getDeclaringClass().getModifiers()))) { ao.setAccessible(true); } } catch (SecurityException se) { // 17-Apr-2009, tatu: Related to [JACKSON-101]: this can fail on platforms like // Google App Engine); so let's only fail if we really needed it... if (!ao.isAccessible()) { Class<?> declClass = member.getDeclaringClass(); throw new IllegalArgumentException("Can not access "+member+" (from class "+declClass.getName()+"; failed to set access: "+se.getMessage()); } } } /* /********************************************************** /* Enum type detection /********************************************************** */ /** * Helper method that can be used to dynamically figure out * enumeration type of given {@link EnumSet}, without having * access to its declaration. * Code is needed to work around design

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.getAnnotation(JacksonStdImpl.class) != null); } public static boolean isBogusClass(Class<?> cls) { return (cls == Void.class || cls == Void.TYPE || cls == com.fasterxml.jackson.databind.annotation.NoClass.class); } public static boolean isNonStaticInnerClass(Class<?> cls) { return !Modifier.isStatic(cls.getModifiers()) && (getEnclosingClass(cls) != null); } /** * @since 2.7 */ public static boolean isObjectOrPrimitive(Class<?> cls) { return (cls == CLS_OBJECT) || cls.isPrimitive(); } /* /********************************************************** /* Helper classes /********************************************************** */ /** * Inner class used to contain gory details of how we can determine * details of instances of common JDK types like {@link EnumMap}s. */ private static class EnumTypeLocator { final static EnumTypeLocator instance = new EnumTypeLocator(); private final Field enumSetTypeField; private final Field enumMapTypeField; private EnumTypeLocator() { //JDK uses following fields to store information about actual Enumeration // type for EnumSets, EnumMaps... enumSetTypeField = locateField(EnumSet.class, "elementType", Class.class); enumMapTypeField = locateField(EnumMap.class, "elementType", Class.class); } @SuppressWarnings("unchecked") public Class<? extends Enum<?>> enumTypeFor(EnumSet<?> set) { if (enumSetTypeField != null) { return (Class<? extends Enum<?>>) get(set, enumSetTypeField); } throw new IllegalStateException("Can not figure out type for EnumSet (odd JDK platform?)"); } @SuppressWarnings("unchecked") public Class<? extends Enum<?>> enumTypeFor(EnumMap<?,?> set) { if (enumMapTypeField != null) { return (Class<? extends Enum<?>>) get(set, enumMapTypeField); } throw new IllegalStateException("Can not figure out type for EnumMap (odd JDK platform?)"); } private Object get(Object bean, Field field) { try { return field.get(bean); } catch (Exception e) { throw new IllegalArgumentException(e); } } private static Field locateField(Class<?> fromClass, String expectedName, Class<?> type) { Field found = null; // First: let's see if we can find exact match: Field[] fields = getDeclaredFields(fromClass); for (Field f : fields) { if (expectedName.equals(f.getName()) && f.getType() == type) { found = f; break; } } // And if not, if there is just one field with the type, that field if (found == null) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> for (Field f : fields) { if (f.getType() == type) { // If more than one, can't choose if (found != null) return null; found = f; } } } if (found != null) { // it's non-public, need to force accessible try { found.setAccessible(true); } catch (Throwable t) { } } return found; } } /* /********************************************************** /* Helper classed used for caching /********************************************************** */ /** * @since 2.7 */ private final static class ClassMetadata { private final static Annotation[] NO_ANNOTATIONS = new Annotation[0]; private final static Ctor[] NO_CTORS = new Ctor[0]; private final Class<?> _forClass; private String _packageName; private Boolean _hasEnclosingMethod; private Class<?>[] _interfaces; private Type[] _genericInterfaces; private Annotation[] _annotations; private Ctor[] _constructors; private Field[] _fields; private Method[] _methods; public ClassMetadata(Class<?> forClass) { _forClass = forClass; } public String getPackageName() { String name = _packageName; if (name == null) { Package pkg = _forClass.getPackage(); name = (pkg == null) ? null : pkg.getName(); if (name == null) { name = ""; } _packageName = name; } return (name == "") ? null : name; } // 19-Sep-2015, tatu: Bit of performance improvement, after finding this // in profile; maybe 5% in "wasteful" deserialization case public Class<?>[] getInterfaces() { Class<?>[] result = _interfaces; if (result == null) { result = _forClass.getInterfaces(); _interfaces = result; } return result; } // 30-Oct-2015, tatu: Minor performance boost too (5% or less) public Type[] getGenericInterfaces() { Type[] result = _genericInterfaces; if (result == null) { result = _forClass.getGenericInterfaces(); _genericInterfaces = result; } return result; } // 19-Sep-2015, tatu: Modest performance improvement, after finding this // in profile; maybe 2-3% in "wasteful" deserialization case public Annotation[] getDeclaredAnnotations() { Annotation[] result = _annotations; if (result == null) { result = isObjectOrPrimitive() ? NO_ANNOTATIONS : _forClass.getDeclaredAnnotations(); _annotations = result; } return result; } // 1

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> // if so, no recursion; however, may need to update name? if (namedType.hasName()) { NamedType prev = collectedSubtypes.get(namedType); if (!prev.hasName()) { collectedSubtypes.put(namedType, namedType); } } return; } // if it wasn't, add and check subtypes recursively collectedSubtypes.put(namedType, namedType); Collection<NamedType> st = ai.findSubtypes(annotatedType); if (st != null && !st.isEmpty()) { for (NamedType subtype : st) { AnnotatedClass subtypeClass = AnnotatedClass.constructWithoutSuperTypes(subtype.getType(), config); _collectAndResolve(subtypeClass, subtype, config, ai, collectedSubtypes); } } } /** * Method called to find subtypes for a specific type (class), using * type id as the unique key (in case of conflicts). */ protected void _collectAndResolveByTypeId(AnnotatedClass annotatedType, NamedType namedType, MapperConfig<?> config, Set<Class<?>> typesHandled, Map<String,NamedType> byName) { final AnnotationIntrospector ai = config.getAnnotationIntrospector(); if (!namedType.hasName()) { String name = ai.findTypeName(annotatedType); if (name != null) { namedType = new NamedType(namedType.getType(), name); } } if (namedType.hasName()) { byName.put(namedType.getName(), namedType); } // only check subtypes if this type hadn't yet been handled if (typesHandled.add(namedType.getType())) { Collection<NamedType> st = ai.findSubtypes(annotatedType); if (st != null && !st.isEmpty()) { for (NamedType subtype : st) { AnnotatedClass subtypeClass = AnnotatedClass.constructWithoutSuperTypes(subtype.getType(), config); _collectAndResolveByTypeId(subtypeClass, subtype, config, typesHandled, byName); } } } } /** * Helper method used for merging explicitly named types and handled classes * without explicit names. */ protected Collection<NamedType> _combineNamedAndUnnamed(Set<Class<?>> typesHandled, Map<String,NamedType> byName) { ArrayList<NamedType> result = new ArrayList<NamedType>(byName.values()); // Ok, so... we will figure out which classes have no explicitly assigned name, // by removing Classes from Set. And for remaining classes, add an anonymous // marker for (NamedType t : byName.values()) { typesHandled.remove(t.getType()); } for (Class<?> cls : typesHandled) { result.add(new NamedType(cls)); } return result; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>() { return _first; } public String getLast() { return _last; } public void setFirst(String s) { _first = s; } public void setLast(String s) { _last = s; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; Name other = (Name) o; return _first.equals(other._first) && _last.equals(other._last); } } private Gender _gender; private Name _name; private boolean _isVerified; private byte[] _userImage; public FiveMinuteUser() { } public FiveMinuteUser(String first, String last, boolean verified, Gender g, byte[] data) { _name = new Name(first, last); _isVerified = verified; _gender = g; _userImage = data; } public Name getName() { return _name; } public boolean isVerified() { return _isVerified; } public Gender getGender() { return _gender; } public byte[] getUserImage() { return _userImage; } public void setName(Name n) { _name = n; } public void setVerified(boolean b) { _isVerified = b; } public void setGender(Gender g) { _gender = g; } public void setUserImage(byte[] b) { _userImage = b; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; FiveMinuteUser other = (FiveMinuteUser) o; if (_isVerified != other._isVerified) return false; if (_gender != other._gender) return false; if (!_name.equals(other._name)) return false; byte[] otherImage = other._userImage; if (otherImage.length != _userImage.length) return false; for (int i = 0, len = _userImage.length; i < len; ++i) { if (_userImage[i] != otherImage[i]) { return false; } } return true; } } /* /********************************************************** /* High-level helpers /********************************************************** */ protected void verifyJsonSpecSampleDoc(JsonParser jp, boolean verifyContents) throws IOException { verifyJsonSpecSampleDoc(jp, verifyContents, true); } protected void verifyJsonSpecSampleDoc(JsonParser jp, boolean verifyContents, boolean requireNumbers) throws IOException { if (!jp.hasCurrentToken()) { jp.nextToken(); } assertToken(JsonToken.START_OBJECT, jp.getCurrentToken()); // main object assertToken(JsonToken.FIELD_NAME, jp.nextToken());

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID1); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[1] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID2); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[2] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID3); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[3] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID4); } assertToken(JsonToken.END_ARRAY, jp.nextToken()); // 'ids' array assertToken(JsonToken.END_OBJECT, jp.nextToken()); // 'image' object assertToken(JsonToken.END_OBJECT, jp.nextToken()); // main object } private void verifyIntToken(JsonToken t, boolean requireNumbers) { if (t == JsonToken.VALUE_NUMBER_INT) { return; } if (requireNumbers) { // to get error assertToken(JsonToken.VALUE_NUMBER_INT, t); } // if not number, must be String if (t != JsonToken.VALUE_STRING) { fail("Expected INT or STRING value, got "+t); } } protected void verifyFieldName(JsonParser jp, String expName) throws IOException { assertEquals(expName, jp.getText()); assertEquals(expName, jp.getCurrentName()); } protected void verifyIntValue(JsonParser jp, long expValue) throws IOException { // First, via textual assertEquals(String.valueOf(expValue), jp.getText()); } /** * Method that checks whether Unit tests appear to run from Ant build * scripts. * * @since 1.6 */ protected static boolean runsFromAnt() { return "true".equals(System.getProperty("FROM_ANT")); } /* /********************************************************** /* Parser/generator construction /********************************************************** */ protected JsonParser createParserUsingReader(String input) throws IOException, JsonParseException { return createParserUsingReader(new JsonFactory(), input); } protected JsonParser createParserUsingReader(JsonFactory f, String input) throws IOException, JsonParseException { return f.createParser(new StringReader(input)); } protected JsonParser createParserUsingStream(String input, String encoding) throws IOException, JsonParseException { return createParserUsingStream(new JsonFactory(), input, encoding); } protected JsonParser createParserUsingStream(JsonFactory f, String input, String encoding) throws IOException, JsonParseException { /* 23-Apr-2008, tatus: UTF-32 is not supported by JDK, have

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> to * use our own codec too (which is not optimal since there's * a chance both encoder and decoder might have bugs, but ones * that cancel each other out or such) */ byte[] data; if (encoding.equalsIgnoreCase("UTF-32")) { data = encodeInUTF32BE(input); } else { data = input.getBytes(encoding); } InputStream is = new ByteArrayInputStream(data); return f.createParser(is); } /* /********************************************************** /* Additional assertion methods /********************************************************** */ protected void assertToken(JsonToken expToken, JsonToken actToken) { if (actToken != expToken) { fail("Expected token "+expToken+", current token "+actToken); } } protected void assertToken(JsonToken expToken, JsonParser jp) { assertToken(expToken, jp.getCurrentToken()); } protected void assertType(Object ob, Class<?> expType) { if (ob == null) { fail("Expected an object of type "+expType.getName()+", got null"); } Class<?> cls = ob.getClass(); if (!expType.isAssignableFrom(cls)) { fail("Expected type "+expType.getName()+", got "+cls.getName()); } } protected void assertValidLocation(JsonLocation location) { assertNotNull("Should have non-null location", location); assertTrue("Should have positive line number", location.getLineNr() > 0); } protected void verifyException(Throwable e, String... matches) { String msg = e.getMessage(); String lmsg = (msg == null) ? "" : msg.toLowerCase(); for (String match : matches) { String lmatch = match.toLowerCase(); if (lmsg.indexOf(lmatch) >= 0) { return; } } fail("Expected an exception with one of substrings ("+Arrays.asList(matches)+"): got one with message \""+msg+"\""); } /** * Method that gets textual contents of the current token using * available methods, and ensures results are consistent, before * returning them */ protected String getAndVerifyText(JsonParser jp) throws IOException, JsonParseException { // Ok, let's verify other accessors int actLen = jp.getTextLength(); char[] ch = jp.getTextCharacters(); String str2 = new String(ch, jp.getTextOffset(), actLen); String str = jp.getText(); if (str.length() != actLen) { fail("Internal problem (jp.token == "+jp.getCurrentToken()+"): jp.getText().length() ['"+str+"'] == "+str.length()+"; jp.getTextLength() == "+actLen); } assertEquals("String access via getText(), getTextXxx() must be the same", str, str2); return str; } /*

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Factory._getBufferRecycler()); try { _configAndWriteValue(_generatorFactory.createGenerator(bb, JsonEncoding.UTF8), value); } catch (JsonProcessingException e) { // to support [JACKSON-758] throw e; } catch (IOException e) { // shouldn't really happen, but is declared as possibility so: throw JsonMappingException.fromUnexpectedIOE(e); } byte[] result = bb.toByteArray(); bb.release(); return result; } /* /********************************************************** /* Other public methods /********************************************************** */ /** * Method for visiting type hierarchy for given type, using specified visitor. * Visitation uses <code>Serializer</code> hierarchy and related properties *<p> * This method can be used for things like * generating <a href="http://json-schema.org/">Json Schema</a> * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) * * @since 2.2 */ public void acceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor) throws JsonMappingException { if (type == null) { throw new IllegalArgumentException("type must be provided"); } _serializerProvider().acceptJsonFormatVisitor(type, visitor); } /** * Since 2.6 */ public void acceptJsonFormatVisitor(Class<?> rawType, JsonFormatVisitorWrapper visitor) throws JsonMappingException { acceptJsonFormatVisitor(_config.constructType(rawType), visitor); } public boolean canSerialize(Class<?> type) { return _serializerProvider().hasSerializerFor(type, null); } /** * Method for checking whether instances of given type can be serialized, * and optionally why (as per {@link Throwable} returned). * * @since 2.3 */ public boolean canSerialize(Class<?> type, AtomicReference<Throwable> cause) { return _serializerProvider().hasSerializerFor(type, cause); } /* /********************************************************** /* Overridable helper methods /********************************************************** */ /** * Overridable helper method used for constructing * {@link SerializerProvider} to use for serialization. */ protected DefaultSerializerProvider _serializerProvider() { return _serializerProvider.createInstance(_config, _serializerFactory); } /* /********************************************************** /* Internal methods /********************************************************** */ /** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_generatorFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_generatorFactory.getFormatName()); } } } /** * Method called to configure the generator as necessary and then * call write functionality

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> */ public final static class GeneratorSettings implements java.io.Serializable { private static final long serialVersionUID = 1L; public final static GeneratorSettings empty = new GeneratorSettings(null, null, null, null); /** * To allow for dynamic enabling/disabling of pretty printing, * pretty printer can be optionally configured for writer * as well */ public final PrettyPrinter prettyPrinter; /** * When using data format that uses a schema, schema is passed * to generator. */ public final FormatSchema schema; /** * Caller may want to specify character escaping details, either as * defaults, or on call-by-call basis. */ public final CharacterEscapes characterEscapes; /** * Caller may want to override so-called "root value separator", * String added (verbatim, with no quoting or escaping) between * values in root context. Default value is a single space character, * but this is often changed to linefeed. */ public final SerializableString rootValueSeparator; public GeneratorSettings(PrettyPrinter pp, FormatSchema sch, CharacterEscapes esc, SerializableString rootSep) { prettyPrinter = pp; schema = sch; characterEscapes = esc; rootValueSeparator = rootSep; } public GeneratorSettings with(PrettyPrinter pp) { // since null would mean "don't care", need to use placeholder to indicate "disable" if (pp == null) { pp = NULL_PRETTY_PRINTER; } return (pp == prettyPrinter) ? this : new GeneratorSettings(pp, schema, characterEscapes, rootValueSeparator); } public GeneratorSettings with(FormatSchema sch) { return (schema == sch) ? this : new GeneratorSettings(prettyPrinter, sch, characterEscapes, rootValueSeparator); } public GeneratorSettings with(CharacterEscapes esc) { return (characterEscapes == esc) ? this : new GeneratorSettings(prettyPrinter, schema, esc, rootValueSeparator); } public GeneratorSettings withRootValueSeparator(String sep) { if (sep == null) { if (rootValueSeparator == null) { return this; } } else if (sep.equals(rootValueSeparator)) { return this; } return new GeneratorSettings(prettyPrinter, schema, characterEscapes, (sep == null) ? null : new SerializedString(sep)); } public GeneratorSettings withRootValueSeparator(SerializableString sep) { if (sep == null) { if (rootValueSeparator == null) { return this; } } else { if (rootValueSeparator != null && sep.getValue().equals(rootValueSeparator.getValue())) { return this; } } return new GeneratorSettings(prettyPrinter, schema, characterEscapes, sep); } /** * @since 2.6 */ public void initialize(Json

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Generator gen) { PrettyPrinter pp = prettyPrinter; if (prettyPrinter != null) { if (pp == NULL_PRETTY_PRINTER) { gen.setPrettyPrinter(null); } else { if (pp instanceof Instantiatable<?>) { pp = (PrettyPrinter) ((Instantiatable<?>) pp).createInstance(); } gen.setPrettyPrinter(pp); } } if (characterEscapes != null) { gen.setCharacterEscapes(characterEscapes); } if (schema != null) { gen.setSchema(schema); } if (rootValueSeparator != null) { gen.setRootValueSeparator(rootValueSeparator); } } } /** * As a minor optimization, we will make an effort to pre-fetch a serializer, * or at least relevant <code>TypeSerializer</code>, if given enough * information. * * @since 2.5 */ public final static class Prefetch implements java.io.Serializable { private static final long serialVersionUID = 1L; public final static Prefetch empty = new Prefetch(null, null, null); /** * Specified root serialization type to use; can be same * as runtime type, but usually one of its super types * (parent class or interface it implements). */ private final JavaType rootType; /** * We may pre-fetch serializer if {@link #rootType} * is known, and if so, reuse it afterwards. * This allows avoiding further serializer lookups and increases * performance a bit on cases where readers are reused. */ private final JsonSerializer<Object> valueSerializer; /** * When dealing with polymorphic types, we can not pre-fetch * serializer, but can pre-fetch {@link TypeSerializer}. */ private final TypeSerializer typeSerializer; private Prefetch(JavaType rootT, JsonSerializer<Object> ser, TypeSerializer typeSer) { rootType = rootT; valueSerializer = ser; typeSerializer = typeSer; } public Prefetch forRootType(ObjectWriter parent, JavaType newType) { // First: if nominal type not defined, or trivial (java.lang.Object), // not thing much to do boolean noType = (newType == null) || newType.isJavaLangObject(); if (noType) { if ((rootType == null) || (valueSerializer == null)) { return this; } return new Prefetch(null, null, typeSerializer); } if (newType.equals(rootType)) { return this; } if (parent.isEnabled(SerializationFeature.EAGER_SERIALIZER_FETCH)) { DefaultSerializerProvider prov = parent._serializerProvider(); // 17-Dec-2014, tatu: Need to be bit careful here; TypeSerializers are NOT cached, //

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>i] == origProp) { creatorProps[i] = prop; break; } // ... as per above, it is possible we'd need to add this as fallback // if (but only if) identity check fails? /* if (creatorProps[i].getName().equals(prop.getName())) { creatorProps[i] = prop; break; } */ } } } // one more thing: if this property uses "external property" type inclusion, // it needs different handling altogether if (prop.hasValueTypeDeserializer()) { TypeDeserializer typeDeser = prop.getValueTypeDeserializer(); if (typeDeser.getTypeInclusion() == JsonTypeInfo.As.EXTERNAL_PROPERTY) { if (extTypes == null) { extTypes = new ExternalTypeHandler.Builder(); } extTypes.addExternal(prop, typeDeser); // In fact, remove from list of known properties to simplify later handling _beanProperties.remove(prop); continue; } } } // "any setter" may also need to be resolved now if (_anySetter != null && !_anySetter.hasValueDeserializer()) { _anySetter = _anySetter.withValueDeserializer(findDeserializer(ctxt, _anySetter.getType(), _anySetter.getProperty())); } // as well as delegate-based constructor: if (_valueInstantiator.canCreateUsingDelegate()) { JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); if (delegateType == null) { throw new IllegalArgumentException("Invalid delegate-creator definition for "+_beanType +": value instantiator ("+_valueInstantiator.getClass().getName() +") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'"); } _delegateDeserializer = _findDelegateDeserializer(ctxt, delegateType, _valueInstantiator.getDelegateCreator()); } // and array-delegate-based constructor: if (_valueInstantiator.canCreateUsingArrayDelegate()) { JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig()); if (delegateType == null) { throw new IllegalArgumentException("Invalid array-delegate-creator definition for "+_beanType +": value instantiator ("+_valueInstantiator.getClass().getName() +") returned true for 'canCreateUsingArrayDelegate()', but null for 'getArrayDelegateType()'"); } _arrayDelegateDeserializer = _findDelegateDeserializer(ctxt, delegateType, _valueInstantiator.getArrayDelegateCreator()); } // And now that we know CreatorProperty instances are also resolved can finally create the creator: if (creatorProps != null) { _propertyBasedCreator = PropertyBasedCreator.construct(ctxt, _valueInstantiator, creatorProps); } if (extTypes != null) { _externalTypeIdHandler = extTypes.build(); // we consider this non-standard

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> : property.getMember(); if (accessor != null && intr != null) { ObjectIdInfo objectIdInfo = intr.findObjectIdInfo(accessor); if (objectIdInfo != null) { // some code duplication here as well (from BeanDeserializerFactory) // 2.1: allow modifications by "id ref" annotations as well: objectIdInfo = intr.findObjectReferenceInfo(accessor, objectIdInfo); Class<?> implClass = objectIdInfo.getGeneratorType(); // Property-based generator is trickier JavaType idType; SettableBeanProperty idProp; ObjectIdGenerator<?> idGen; ObjectIdResolver resolver = ctxt.objectIdResolverInstance(accessor, objectIdInfo); if (implClass == ObjectIdGenerators.PropertyGenerator.class) { PropertyName propName = objectIdInfo.getPropertyName(); idProp = findProperty(propName); if (idProp == null) { throw new IllegalArgumentException("Invalid Object Id definition for " +handledType().getName()+": can not find property with name '"+propName+"'"); } idType = idProp.getType(); idGen = new PropertyBasedObjectIdGenerator(objectIdInfo.getScope()); } else { // other types need to be simpler JavaType type = ctxt.constructType(implClass); idType = ctxt.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0]; idProp = null; idGen = ctxt.objectIdGeneratorInstance(accessor, objectIdInfo); } JsonDeserializer<?> deser = ctxt.findRootValueDeserializer(idType); oir = ObjectIdReader.construct(idType, objectIdInfo.getPropertyName(), idGen, deser, idProp, resolver); } } // either way, need to resolve serializer: BeanDeserializerBase contextual = this; if (oir != null && oir != _objectIdReader) { contextual = contextual.withObjectIdReader(oir); } // And possibly add more properties to ignore if (accessor != null) { String[] ignorals = intr.findPropertiesToIgnore(accessor, false); if (ignorals != null && ignorals.length != 0) { HashSet<String> newIgnored = ArrayBuilders.setAndArray(contextual._ignorableProps, ignorals); contextual = contextual.withIgnorableProperties(newIgnored); } } // One more thing: are we asked to serialize POJO as array? JsonFormat.Shape shape = null; if (accessor != null) { JsonFormat.Value format = intr.findFormat((Annotated) accessor); if (format != null) { shape = format.getShape(); } } if (shape == null) { shape = _serializationShape; } if (shape == JsonFormat.Shape.ARRAY) { contextual = contextual.asArrayDeserializer(); } return contextual;

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } /** * Helper method called to see if given property is part of 'managed' property * pair (managed + back reference), and if so, handle resolution details. */ protected SettableBeanProperty _resolveManagedReferenceProperty(DeserializationContext ctxt, SettableBeanProperty prop) { String refName = prop.getManagedReferenceName(); if (refName == null) { return prop; } JsonDeserializer<?> valueDeser = prop.getValueDeserializer(); SettableBeanProperty backProp = valueDeser.findBackReference(refName); if (backProp == null) { throw new IllegalArgumentException("Can not handle managed/back reference '"+refName+"': no back reference property found from type " +prop.getType()); } // also: verify that type is compatible JavaType referredType = _beanType; JavaType backRefType = backProp.getType(); boolean isContainer = prop.getType().isContainerType(); if (!backRefType.getRawClass().isAssignableFrom(referredType.getRawClass())) { throw new IllegalArgumentException("Can not handle managed/back reference '"+refName+"': back reference type (" +backRefType.getRawClass().getName()+") not compatible with managed type (" +referredType.getRawClass().getName()+")"); } return new ManagedReferenceProperty(prop, refName, backProp, _classAnnotations, isContainer); } /** * Method that wraps given property with {@link ObjectIdReferenceProperty} * in case where object id resolution is required. */ protected SettableBeanProperty _resolvedObjectIdProperty(DeserializationContext ctxt, SettableBeanProperty prop) { ObjectIdInfo objectIdInfo = prop.getObjectIdInfo(); JsonDeserializer<Object> valueDeser = prop.getValueDeserializer(); ObjectIdReader objectIdReader = valueDeser.getObjectIdReader(); if (objectIdInfo == null && objectIdReader == null) { return prop; } return new ObjectIdReferenceProperty(prop, objectIdInfo); } /** * Helper method called to see if given property might be so-called unwrapped * property: these require special handling. */ protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationContext ctxt, SettableBeanProperty prop) { AnnotatedMember am = prop.getMember(); if (am != null) { NameTransformer unwrapper = ctxt.getAnnotationIntrospector().findUnwrappingNameTransformer(am); if (unwrapper != null) { JsonDeserializer<Object> orig = prop.getValueDeserializer(); JsonDeserializer<Object> unwrapping = orig.unwrappingDeserializer(unwrapper); if (unwrapping != orig && unwrapping != null) { // might be cleaner to create new instance; but difficult to do reliably, so: return prop.withValueDeserializer(unwrapping); } } } return null; } /** * Helper method that will handle gruesome details of

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> dealing with properties * that have non-static inner class as value... */ protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationContext ctxt, SettableBeanProperty prop) { /* Should we encounter a property that has non-static inner-class * as value, we need to add some more magic to find the "hidden" constructor... */ JsonDeserializer<Object> deser = prop.getValueDeserializer(); // ideally wouldn't rely on it being BeanDeserializerBase; but for now it'll have to do if (deser instanceof BeanDeserializerBase) { BeanDeserializerBase bd = (BeanDeserializerBase) deser; ValueInstantiator vi = bd.getValueInstantiator(); if (!vi.canCreateUsingDefault()) { // no default constructor Class<?> valueClass = prop.getType().getRawClass(); Class<?> enclosing = ClassUtil.getOuterClass(valueClass); // and is inner class of the bean class... if (enclosing != null && enclosing == _beanType.getRawClass()) { for (Constructor<?> ctor : valueClass.getConstructors()) { Class<?>[] paramTypes = ctor.getParameterTypes(); if (paramTypes.length == 1 && paramTypes[0] == enclosing) { if (ctxt.canOverrideAccessModifiers()) { ClassUtil.checkAndFixAccess(ctor, ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } return new InnerClassProperty(prop, ctor); } } } } } return prop; } /* /********************************************************** /* Public accessors /********************************************************** */ @Override public boolean isCachable() { return true; } @Override public Class<?> handledType() { return _beanType.getRawClass(); } /** * Overridden to return true for those instances that are * handling value for which Object Identity handling is enabled * (either via value type or referring property). */ @Override public ObjectIdReader getObjectIdReader() { return _objectIdReader; } public boolean hasProperty(String propertyName) { return _beanProperties.find(propertyName) != null; } public boolean hasViews() { return _needViewProcesing; } /** * Accessor for checking number of deserialized properties. */ public int getPropertyCount() { return _beanProperties.size(); } @Override public Collection<Object> getKnownPropertyNames() { ArrayList<Object> names = new ArrayList<Object>(); for (SettableBeanProperty prop : _beanProperties) { names.add(prop.getName()); } return names; } /** * @deprecated Since 2.3, use {@link #handledType()} instead */ @Deprecated public final Class<?> getBeanClass() { return _beanType.getRawClass(); } @Override public JavaType getValueType() { return _bean

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>ator.createFromBoolean(ctxt, value); } public Object deserializeFromArray(JsonParser p, DeserializationContext ctxt) throws IOException { if (_arrayDelegateDeserializer != null) { try { Object bean = _valueInstantiator.createUsingArrayDelegate(ctxt, _arrayDelegateDeserializer.deserialize(p, ctxt)); if (_injectables != null) { injectValues(ctxt, bean); } return bean; } catch (Exception e) { wrapInstantiationProblem(e, ctxt); } } // fallback to non-array delegate if (_delegateDeserializer != null) { try { Object bean = _valueInstantiator.createUsingArrayDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); if (_injectables != null) { injectValues(ctxt, bean); } return bean; } catch (Exception e) { wrapInstantiationProblem(e, ctxt); } } if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { JsonToken t = p.nextToken(); if (t == JsonToken.END_ARRAY && ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { return null; } final Object value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array"); } return value; } if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { JsonToken t = p.nextToken(); if (t == JsonToken.END_ARRAY) { return null; } throw ctxt.mappingException(handledType(), JsonToken.START_ARRAY); } throw ctxt.mappingException(handledType()); } public Object deserializeFromEmbedded(JsonParser p, DeserializationContext ctxt) throws IOException { // First things first: id Object Id is used, most likely that's it; specifically, // true for UUIDs when written as binary (with Smile, other binary formats) if (_objectIdReader != null) { return deserializeFromObjectId(p, ctxt); } // TODO: maybe add support for ValueInstantiator, embedded? return p.getEmbeddedObject(); } /* /********************************************************** /* Overridable helper methods /********************************************************** */ protected void injectValues(DeserializationContext ctxt, Object bean) throws IOException { for (ValueInjector injector : _injectables) { injector.inject(ctxt, bean); } } /** * Method called to handle set of one or more unknown properties, * stored in their entirety in given {@link TokenBuffer} * (as field entries, name

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import com.fasterxml.jackson.databind.*; /** * Container class that contains serializers for JDK types that * require special handling for some reason. */ public class JdkDeserializers { private final static HashSet<String> _classNames = new HashSet<String>(); static { // note: can skip primitive types; other ways to check them: Class<?>[] types = new Class<?>[] { UUID.class, AtomicBoolean.class, StackTraceElement.class, ByteBuffer.class }; for (Class<?> cls : types) { _classNames.add(cls.getName()); } for (Class<?> cls : FromStringDeserializer.types()) { _classNames.add(cls.getName()); } } public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { JsonDeserializer<?> d = FromStringDeserializer.findDeserializer(rawType); if (d != null) { return d; } if (rawType == UUID.class) { return new UUIDDeserializer(); } if (rawType == StackTraceElement.class) { return new StackTraceElementDeserializer(); } if (rawType == AtomicBoolean.class) { // (note: AtomicInteger/Long work due to single-arg constructor. For now? return new AtomicBooleanDeserializer(); } if (rawType == ByteBuffer.class) { return new ByteBufferDeserializer(); } } return null; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> = null; try { node = org.w3c.dom.Node.class; doc = org.w3c.dom.Document.class; } catch (Exception e) { // not optimal but will do System.err.println("WARNING: could not load DOM Node and/or Document classes"); } CLASS_DOM_NODE = node; CLASS_DOM_DOCUMENT = doc; } // // But Java7 type(s) may or may not be; dynamic lookup should be fine, still // // (note: also assume it comes from JDK so that ClassLoader issues with OSGi // // can, I hope, be avoided?) private final static Class<?> CLASS_JAVA7_PATH; static { Class<?> cls = null; try { cls = Class.forName("java.nio.file.Path"); } catch (Exception e) { // not optimal but will do System.err.println("WARNING: could not load Java7 Path class"); } CLASS_JAVA7_PATH = cls; } public final static OptionalHandlerFactory instance = new OptionalHandlerFactory(); protected OptionalHandlerFactory() { } /* /********************************************************** /* Public API /********************************************************** */ public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) { final Class<?> rawType = type.getRawClass(); if ((CLASS_JAVA7_PATH != null) && CLASS_JAVA7_PATH.isAssignableFrom(rawType)) { return ToStringSerializer.instance; } if ((CLASS_DOM_NODE != null) && CLASS_DOM_NODE.isAssignableFrom(rawType)) { return (JsonSerializer<?>) instantiate(SERIALIZER_FOR_DOM_NODE); } String className = rawType.getName(); String factoryName; if (className.startsWith(PACKAGE_PREFIX_JAVAX_XML) || hasSuperClassStartingWith(rawType, PACKAGE_PREFIX_JAVAX_XML)) { factoryName = SERIALIZERS_FOR_JAVAX_XML; } else { return null; } Object ob = instantiate(factoryName); if (ob == null) { // could warn, if we had logging system (j.u.l?) return null; } return ((Serializers) ob).findSerializer(config, type, beanDesc); } public JsonDeserializer<?> findDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { final Class<?> rawType = type.getRawClass(); if ((CLASS_JAVA7_PATH != null) && CLASS_JAVA7_PATH.isAssignableFrom(rawType)) { return (JsonDeserializer<?>) instantiate(DESERIALIZER_FOR_PATH); } if ((CLASS_DOM_NODE != null) && CLASS_DOM_NODE.isAssignableFrom(rawType)) { return (JsonDeserializer<?>) instantiate(DE

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>SERIALIZER_FOR_DOM_NODE); } if ((CLASS_DOM_DOCUMENT != null) && CLASS_DOM_DOCUMENT.isAssignableFrom(rawType)) { return (JsonDeserializer<?>) instantiate(DESERIALIZER_FOR_DOM_DOCUMENT); } String className = rawType.getName(); String factoryName; if (className.startsWith(PACKAGE_PREFIX_JAVAX_XML) || hasSuperClassStartingWith(rawType, PACKAGE_PREFIX_JAVAX_XML)) { factoryName = DESERIALIZERS_FOR_JAVAX_XML; } else { return null; } Object ob = instantiate(factoryName); if (ob == null) { // could warn, if we had logging system (j.u.l?) return null; } return ((Deserializers) ob).findBeanDeserializer(type, config, beanDesc); } /* /********************************************************** /* Internal helper methods /********************************************************** */ private Object instantiate(String className) { try { return Class.forName(className).newInstance(); } catch (LinkageError e) { } // too many different kinds to enumerate here: catch (Exception e) { } return null; } /** * Since 2.7 we only need to check for class extension, as all implemented * types are classes, not interfaces. This has performance implications for * some cases, as we do not need to go over interfaces implemented, just * superclasses * * @since 2.7 */ private boolean hasSuperClassStartingWith(Class<?> rawType, String prefix) { for (Class<?> supertype = rawType.getSuperclass(); supertype != null; supertype = supertype.getSuperclass()) { if (supertype == Object.class) { return false; } if (supertype.getName().startsWith(prefix)) { return true; } } return false; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw JsonMappingException.from(this, "Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); } /** * Method that will try to find a serializer, either from cache * or by constructing one; but will not return an "unknown" serializer * if this can not be done but rather returns null. * * @return Serializer if one can be found, null if not. */ protected JsonSerializer<Object> _findExplicitUntypedSerializer(Class<?> runtimeType) throws JsonMappingException { // Fast lookup from local lookup thingy works? JsonSerializer<Object> ser = _knownSerializers.untypedValueSerializer(runtimeType); if (ser == null) { // If not, maybe shared map already has it? ser = _serializerCache.untypedValueSerializer(runtimeType); if (ser == null) { ser = _createAndCacheUntypedSerializer(runtimeType); } } /* 18-Sep-2014, tatu: This is unfortunate patch over related change * that pushes creation of "unknown type" serializer deeper down * in BeanSerializerFactory; as a result, we need to "undo" creation * here. */ if (isUnknownTypeSerializer(ser)) { return null; } return ser; } /* /********************************************************** /* Low-level methods for actually constructing and initializing /* serializers /********************************************************** */ /** * Method that will try to construct a value serializer; and if * one is successfully created, cache it for reuse. */ protected JsonSerializer<Object> _createAndCacheUntypedSerializer(Class<?> rawType) throws JsonMappingException { JavaType fullType = _config.constructType(rawType); JsonSerializer<Object> ser; try { ser = _createUntypedSerializer(fullType); } catch (IllegalArgumentException iae) { /* We better only expose checked exceptions, since those * are what caller is expected to handle */ throw JsonMappingException.from(this, iae.getMessage(), iae); } if (ser != null) { // 21-Dec-2015, tatu: Best to cache for both raw and full-type key _serializerCache.addAndResolveNonTypedSerializer(rawType, fullType, ser, this); } return ser; } protected JsonSerializer<Object> _createAndCacheUntypedSerializer(JavaType type) throws JsonMappingException { JsonSerializer<Object> ser; try { ser = _createUntypedSerializer(type); } catch (IllegalArgumentException iae) { /* We better only expose checked exceptions, since those * are what caller is expected

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import java.sql.Timestamp; import java.text.*; import java.util.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.util.StdDateFormat; /** * Container class for core JDK date/time type deserializers. */ @SuppressWarnings("serial") public class DateDeserializers { private final static HashSet<String> _classNames = new HashSet<String>(); static { Class<?>[] numberTypes = new Class<?>[] { Calendar.class, GregorianCalendar.class, java.sql.Date.class, java.util.Date.class, Timestamp.class, }; for (Class<?> cls : numberTypes) { _classNames.add(cls.getName()); } } public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (_classNames.contains(clsName)) { // Start with the most common type if (rawType == Calendar.class) { return new CalendarDeserializer(); } if (rawType == java.util.Date.class) { return DateDeserializer.instance; } if (rawType == java.sql.Date.class) { return new SqlDateDeserializer(); } if (rawType == Timestamp.class) { return new TimestampDeserializer(); } if (rawType == GregorianCalendar.class) { return new CalendarDeserializer(GregorianCalendar.class); } } return null; } /* /********************************************************** /* Intermediate class for Date-based ones /********************************************************** */ protected abstract static class DateBasedDeserializer<T> extends StdScalarDeserializer<T> implements ContextualDeserializer { /** * Specific format to use, if non-null; if null will * just use default format. */ protected final DateFormat _customFormat; /** * Let's also keep format String for reference, to use for error messages */ protected final String _formatString; protected DateBasedDeserializer(Class<?> clz) { super(clz); _customFormat = null; _formatString = null; } protected Date

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> CollectionType withContentTypeHandler(Object h) { return new CollectionType(_class, _bindings, _superClass, _superInterfaces, _elementType.withTypeHandler(h), _valueHandler, _typeHandler, _asStatic); } @Override public CollectionType withValueHandler(Object h) { return new CollectionType(_class, _bindings, _superClass, _superInterfaces, _elementType, h, _typeHandler, _asStatic); } @Override public CollectionType withContentValueHandler(Object h) { return new CollectionType(_class, _bindings, _superClass, _superInterfaces, _elementType.withValueHandler(h), _valueHandler, _typeHandler, _asStatic); } @Override public CollectionType withStaticTyping() { if (_asStatic) { return this; } return new CollectionType(_class, _bindings, _superClass, _superInterfaces, _elementType.withStaticTyping(), _valueHandler, _typeHandler, true); } @Override public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { return new CollectionType(rawType, bindings, superClass, superInterfaces, _elementType, _valueHandler, _typeHandler, _asStatic); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { return "[collection type; class "+_class.getName()+", contains "+_elementType+"]"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * This concrete value class is used to contain boolean (true / false) * values. Only two instances are ever created, to minimize memory * usage. */ public class BooleanNode extends ValueNode { // // Just need two instances... public final static BooleanNode TRUE = new BooleanNode(true); public final static BooleanNode FALSE = new BooleanNode(false); private final boolean _value; private BooleanNode(boolean v) { _value = v; } public static BooleanNode getTrue() { return TRUE; } public static BooleanNode getFalse() { return FALSE; } public static BooleanNode valueOf(boolean b) { return b ? TRUE : FALSE; } @Override public JsonNodeType getNodeType() { return JsonNodeType.BOOLEAN; } @Override public JsonToken asToken() { return _value ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE; } @Override public boolean booleanValue() { return _value; } @Override public String asText() { return _value ? "true" : "false"; } @Override public boolean asBoolean() { return _value; } @Override public boolean asBoolean(boolean defaultValue) { return _value; } @Override public int asInt(int defaultValue) { return _value ? 1 : 0; } @Override public long asLong(long defaultValue) { return _value ? 1L : 0L; } @Override public double asDouble(double defaultValue) { return _value ? 1.0 : 0.0; } @Override public final void serialize(JsonGenerator g, SerializerProvider provider) throws IOException { g.writeBoolean(_value); } @Override public int hashCode() { return _value ? 3 : 1; } @Override public boolean equals(Object o) { /* 11-Mar-2013, tatu: Apparently ClassLoaders can manage to load * different instances, rendering identity comparisons broken. * So let's use value instead. */ if (o == this) return true; if (o == null) return false; if (!(o instanceof BooleanNode)) { return false; } return (_value == ((BooleanNode) o)._value); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Deser) && (_ignorableProperties == ignorable)) { return this; } return new MapDeserializer(this, keyDeser, (JsonDeserializer<Object>) valueDeser, valueTypeDeser, ignorable); } /** * Helper method used to check whether we can just use the default key * deserialization, where JSON String becomes Java String. */ protected final boolean _isStdKeyDeser(JavaType mapType, KeyDeserializer keyDeser) { if (keyDeser == null) { return true; } JavaType keyType = mapType.getKeyType(); if (keyType == null) { // assumed to be Object return true; } Class<?> rawKeyType = keyType.getRawClass(); return ((rawKeyType == String.class || rawKeyType == Object.class) && isDefaultKeyDeserializer(keyDeser)); } public void setIgnorableProperties(String[] ignorable) { _ignorableProperties = (ignorable == null || ignorable.length == 0) ? null : ArrayBuilders.arrayToSet(ignorable); } /* /********************************************************** /* Validation, post-processing (ResolvableDeserializer) /********************************************************** */ @Override public void resolve(DeserializationContext ctxt) throws JsonMappingException { // May need to resolve types for delegate- and/or property-based creators: if (_valueInstantiator.canCreateUsingDelegate()) { JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); if (delegateType == null) { throw new IllegalArgumentException("Invalid delegate-creator definition for "+_mapType +": value instantiator ("+_valueInstantiator.getClass().getName() +") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'"); } /* Theoretically should be able to get CreatorProperty for delegate * parameter to pass; but things get tricky because DelegateCreator * may contain injectable values. So, for now, let's pass nothing. */ _delegateDeserializer = findDeserializer(ctxt, delegateType, null); } if (_valueInstantiator.canCreateFromObjectWith()) { SettableBeanProperty[] creatorProps = _valueInstantiator.getFromObjectArguments(ctxt.getConfig()); _propertyBasedCreator = PropertyBasedCreator.construct(ctxt, _valueInstantiator, creatorProps); } _standardStringKey = _isStdKeyDeser(_mapType, _keyDeserializer); } /** * Method called to finalize setup of this deserializer, * when it is known for which property deserializer is needed for. */ @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { KeyDeserializer kd = _keyDeserializer; if (kd == null) { kd = ctxt.findKeyDeserializer(_mapType.getKeyType(), property); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.*; import com.fasterxml.jackson.databind.JavaType; /** * Placeholder used by virtual properties as placeholder for * underlying {@link AnnotatedMember}. * * @since 2.5 */ public class VirtualAnnotatedMember extends AnnotatedMember implements java.io.Serializable { private static final long serialVersionUID = 1L; protected final Class<?> _declaringClass; protected final Class<?> _rawType; protected final String _name; /* /********************************************************** /* Life-cycle /********************************************************** */ public VirtualAnnotatedMember(TypeResolutionContext typeContext, Class<?> declaringClass, String name, Class<?> rawType) { super(typeContext, /* AnnotationMap*/ null); _declaringClass = declaringClass; _rawType = rawType; _name = name; } @Override public Annotated withAnnotations(AnnotationMap fallback) { return this; } /* /********************************************************** /* Annotated impl /********************************************************** */ @Override public Field getAnnotated() { return null; } @Override public int getModifiers() { return 0; } @Override public String getName() { return _name; } @Override public Class<?> getRawType() { return _rawType; } @Override public JavaType getType() { return _typeContext.resolveType(_rawType); } /* /********************************************************** /* AnnotatedMember impl /********************************************************** */ @Override public Class<?> getDeclaringClass() { return _declaringClass; } @Override public Member getMember() { return null; } @Override public void setValue(Object pojo, Object value) throws IllegalArgumentException { throw new IllegalArgumentException("Can not set virtual property '"+_name+"'"); } @Override public Object getValue(Object pojo) throws IllegalArgumentException { throw new IllegalArgumentException("Can not get virtual property '"+_name+"'"); } /* /********************************************************** /* Extended API, generic /********************************************************** */ public String getFullName() { return getDeclaringClass().getName() + "#" + getName(); } public int getAnnotationCount() { return 0; } @Override public int hashCode() { return _name.hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; VirtualAnnotatedMember other = (VirtualAnnotatedMember) o; return (other._declaringClass == _declaringClass) && other._name.equals(_name); } @Override public String toString() { return "[field "+getFullName()+"]"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.type; import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; public abstract class TypeBase extends JavaType implements JsonSerializable { private static final long serialVersionUID = 1; private final static TypeBindings NO_BINDINGS = TypeBindings.emptyBindings(); private final static JavaType[] NO_TYPES = new JavaType[0]; protected final JavaType _superClass; protected final JavaType[] _superInterfaces; /** * Bindings in effect for this type instance; possibly empty. * Needed when resolving types declared in members of this type * (if any). * * @since 2.7 */ protected final TypeBindings _bindings; /** * Lazily initialized external representation of the type */ volatile transient String _canonicalName; /** * Main constructor to use by extending classes. */ protected TypeBase(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, Object valueHandler, Object typeHandler, boolean asStatic) { super(raw, hash, valueHandler, typeHandler, asStatic); _bindings = (bindings == null) ? NO_BINDINGS : bindings; _superClass = superClass; _superInterfaces = superInts; } /** * Copy-constructor used when refining/upgrading type instances. * * @since 2.7 */ protected TypeBase(TypeBase base) { super(base); _superClass = base._superClass; _superInterfaces = base._superInterfaces; _bindings = base._bindings; } @Override public String toCanonical() { String str = _canonicalName; if (str == null) { str = buildCanonicalName(); } return str; } protected String buildCanonicalName() { return _class.getName(); } @Override public abstract StringBuilder getGenericSignature(StringBuilder sb); @Override public abstract StringBuilder getErasedSignature(StringBuilder sb); @Override @SuppressWarnings("unchecked") public <T> T getValueHandler() { return (T) _valueHandler; } @Override @SuppressWarnings("unchecked") public <T> T getTypeHandler() { return (T) _typeHandler; } @Override public TypeBindings getBindings() { return _bindings; } @Override public int containedTypeCount() { return _bindings.size(); } @Override public JavaType containedType(int index) { return _bindings.getBoundType(index); } @Override @Deprecated public String containedTypeName(int index) { return _bindings.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> sb.append('I'); } else if (cls == Long.TYPE) { sb.append('J'); } else if (cls == Float.TYPE) { sb.append('F'); } else if (cls == Double.TYPE) { sb.append('D'); } else if (cls == Void.TYPE) { sb.append('V'); } else { throw new IllegalStateException("Unrecognized primitive type: "+cls.getName()); } } else { sb.append('L'); String name = cls.getName(); for (int i = 0, len = name.length(); i < len; ++i) { char c = name.charAt(i); if (c == '.') c = '/'; sb.append(c); } if (trailingSemicolon) { sb.append(';'); } } return sb; } /** * Internal helper method used to figure out nominal super-class for * deprecated factory methods / constructors, where we are not given * properly resolved supertype hierarchy. * Will basically give `JavaType` for `java.lang.Object` for classes * other than `java.lafgn.Object`; null for others. * * @since 2.7 */ protected static JavaType _bogusSuperClass(Class<?> cls) { Class<?> parent = cls.getSuperclass(); if (parent == null) { return null; } return TypeFactory.unknownType(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser.impl; import java.io.IOException; import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; @SuppressWarnings("serial") public class UnknownSerializer extends StdSerializer<Object> { public UnknownSerializer() { super(Object.class); } /** * @since 2.6 */ public UnknownSerializer(Class<?> cls) { super(cls, false); } @Override public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException { // 27-Nov-2009, tatu: As per [JACKSON-201] may or may not fail... if (provider.isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)) { failForEmpty(gen, value); } // But if it's fine, we'll just output empty JSON Object: gen.writeStartObject(); gen.writeEndObject(); } @Override public final void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer) throws IOException { if (provider.isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)) { failForEmpty(gen, value); } typeSer.writeTypePrefixForObject(value, gen); typeSer.writeTypeSuffixForObject(value, gen); } @Override public boolean isEmpty(SerializerProvider provider, Object value) { return true; } @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { return null; } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitor.expectAnyFormat(typeHint); } protected void failForEmpty(JsonGenerator gen, Object value) throws JsonMappingException { throw JsonMappingException.from(gen, "No serializer found for class "+value.getClass().getName()+" and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )"); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Collection/Map in this case */ return; } // For [#501] fix we need to implement this but: if (_valueTypeDeserializer != null) { throw JsonMappingException.from(p, "Problem deserializing 'setterless' property (\""+getName()+"\"): no way to handle typed deser with setterless yet"); // return _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer); } // Ok: then, need to fetch Collection/Map to modify: Object toModify; try { toModify = _getter.invoke(instance); } catch (Exception e) { _throwAsIOE(p, e); return; // never gets here } /* Note: null won't work, since we can't then inject anything * in. At least that's not good in common case. However, * theoretically the case where we get JSON null might * be compatible. If so, implementation could be changed. */ if (toModify == null) { throw JsonMappingException.from(p, "Problem deserializing 'setterless' property '"+getName()+"': get method returned null"); } _valueDeserializer.deserialize(p, ctxt, toModify); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeAndSet(p, ctxt, instance); return instance; } @Override public final void set(Object instance, Object value) throws IOException { throw new UnsupportedOperationException("Should never call 'set' on setterless property"); } @Override public Object setAndReturn(Object instance, Object value) throws IOException { set(instance, value); return null; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>); } /** * Method that should NOT to be used by application code: * it does NOT properly handle inspection of super-types, so neither parent * Classes nor implemented Interfaces are accessible with resulting type * instance. Instead, please use {@link TypeFactory}'s <code>constructType</code> * methods which handle introspection appropriately. *<p> * Note that prior to 2.7, method usage was not limited and would typically * have worked acceptably: the problem comes from inability to resolve super-type * information, for which {@link TypeFactory} is needed. * * @deprecated Since 2.7 */ @Deprecated public static SimpleType construct(Class<?> cls) { /* Let's add sanity checks, just to ensure no * Map/Collection entries are constructed */ if (Map.class.isAssignableFrom(cls)) { throw new IllegalArgumentException("Can not construct SimpleType for a Map (class: "+cls.getName()+")"); } if (Collection.class.isAssignableFrom(cls)) { throw new IllegalArgumentException("Can not construct SimpleType for a Collection (class: "+cls.getName()+")"); } // ... and while we are at it, not array types either if (cls.isArray()) { throw new IllegalArgumentException("Can not construct SimpleType for an array (class: "+cls.getName()+")"); } TypeBindings b = TypeBindings.emptyBindings(); return new SimpleType(cls, b, _buildSuperClass(cls.getSuperclass(), b), null, null, null, false); } @Override @Deprecated protected JavaType _narrow(Class<?> subclass) { if (_class == subclass) { return this; } // Should we check that there is a sub-class relationship? // 15-Jan-2016, tatu: Almost yes, but there are some complications with // placeholder values (`Void`, `NoClass`), so can not quite do yet. // TODO: fix in 2.8 if (!_class.isAssignableFrom(subclass)) { /* throw new IllegalArgumentException("Class "+subclass.getName()+" not sub-type of " +_class.getName()); */ return new SimpleType(subclass, _bindings, this, _superInterfaces, _valueHandler, _typeHandler, _asStatic); } // Otherwise, stitch together the hierarchy. First, super-class Class<?> next = subclass.getSuperclass(); if (next == _class) { // straight up parent class? Great. return new SimpleType(subclass, _bindings, this, _superInterfaces, _valueHandler, _typeHandler, _asStatic); } if ((next != null) && _class.isAssignableFrom(next)) { JavaType superb = _narrow(next); return new SimpleType(subclass, _bindings, superb, null, _valueHandler, _

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>typeHandler, _asStatic); } // if not found, try a super-interface Class<?>[] nextI = subclass.getInterfaces(); for (Class<?> iface : nextI) { if (iface == _class) { // directly implemented return new SimpleType(subclass, _bindings, null, new JavaType[] { this }, _valueHandler, _typeHandler, _asStatic); } if (_class.isAssignableFrom(iface)) { // indirect, so recurse JavaType superb = _narrow(iface); return new SimpleType(subclass, _bindings, null, new JavaType[] { superb }, _valueHandler, _typeHandler, _asStatic); } } // should not get here but... throw new IllegalArgumentException("Internal error: Can not resolve sub-type for Class "+subclass.getName()+" to " +_class.getName()); } @Override public JavaType withContentType(JavaType contentType) { throw new IllegalArgumentException("Simple types have no content types; can not call withContentType()"); } @Override public SimpleType withTypeHandler(Object h) { if (_typeHandler == h) { return this; } return new SimpleType(_class, _bindings, _superClass, _superInterfaces, _valueHandler, h, _asStatic); } @Override public JavaType withContentTypeHandler(Object h) { // no content type, so: throw new IllegalArgumentException("Simple types have no content types; can not call withContenTypeHandler()"); } @Override public SimpleType withValueHandler(Object h) { if (h == _valueHandler) { return this; } return new SimpleType(_class, _bindings, _superClass, _superInterfaces, h, _typeHandler, _asStatic); } @Override public SimpleType withContentValueHandler(Object h) { // no content type, so: throw new IllegalArgumentException("Simple types have no content types; can not call withContenValueHandler()"); } @Override public SimpleType withStaticTyping() { return _asStatic ? this : new SimpleType(_class, _bindings, _superClass, _superInterfaces, _valueHandler, _typeHandler, true); } @Override public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { // SimpleType means something not-specialized, so: return null; } @Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); final int count = _bindings.size(); if (count > 0) { sb.append('<'); for (int i = 0; i < count; ++i) { JavaType t = containedType(i); if (i > 0) { sb.append(','); } sb.append

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(t.toCanonical()); } sb.append('>'); } return sb.toString(); } /* /********************************************************** /* Public API /********************************************************** */ @Override public boolean isContainerType() { return false; } @Override public StringBuilder getErasedSignature(StringBuilder sb) { return _classSignature(_class, sb, true); } @Override public StringBuilder getGenericSignature(StringBuilder sb) { _classSignature(_class, sb, false); final int count = _bindings.size(); if (count > 0) { sb.append('<'); for (int i = 0; i < count; ++i) { sb = containedType(i).getGenericSignature(sb); } sb.append('>'); } sb.append(';'); return sb; } /* /********************************************************** /* Internal methods /********************************************************** */ /** * Helper method we need to recursively build skeletal representations * of superclasses. * * @since 2.7 -- remove when not needed (2.8?) */ private static JavaType _buildSuperClass(Class<?> superClass, TypeBindings b) { if (superClass == null) { return null; } if (superClass == Object.class) { return TypeFactory.unknownType(); } JavaType superSuper = _buildSuperClass(superClass.getSuperclass(), b); return new SimpleType(superClass, b, superSuper, null, null, null, false); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { StringBuilder sb = new StringBuilder(40); sb.append("[simple type, class ").append(buildCanonicalName()).append(']'); return sb.toString(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; SimpleType other = (SimpleType) o; // Classes must be identical... if (other._class != this._class) return false; // And finally, generic bindings, if any TypeBindings b1 = _bindings; TypeBindings b2 = other._bindings; return b1.equals(b2); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.util; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; /** * Helper class that contains functionality needed by both serialization * and deserialization side. */ public class BeanUtil { /* /********************************************************** /* Handling property names /********************************************************** */ /** * @since 2.5 */ public static String okNameForGetter(AnnotatedMethod am, boolean stdNaming) { String name = am.getName(); String str = okNameForIsGetter(am, name, stdNaming); if (str == null) { str = okNameForRegularGetter(am, name, stdNaming); } return str; } /** * @since 2.5 */ public static String okNameForRegularGetter(AnnotatedMethod am, String name, boolean stdNaming) { if (name.startsWith("get")) { /* 16-Feb-2009, tatu: To handle [JACKSON-53], need to block * CGLib-provided method "getCallbacks". Not sure of exact * safe criteria to get decent coverage without false matches; * but for now let's assume there's no reason to use any * such getter from CGLib. * But let's try this approach... */ if ("getCallbacks".equals(name)) { if (isCglibGetCallbacks(am)) { return null; } } else if ("getMetaClass".equals(name)) { // 30-Apr-2009, tatu: Need to suppress serialization of a cyclic reference if (isGroovyMetaClassGetter(am)) { return null; } } return stdNaming ? stdManglePropertyName(name, 3) : legacyManglePropertyName(name, 3); } return null; } /** * @since 2.5 */ public static String okNameForIsGetter(AnnotatedMethod am, String name, boolean stdNaming) { if (name.startsWith("is")) { // plus, must return a boolean Class<?> rt = am.getRawType(); if (rt == Boolean.class || rt == Boolean.TYPE) { return stdNaming ? stdManglePropertyName(name, 2) : legacyManglePropertyName(name, 2); } } return null; } /** * @since 2.5 */ public static String okNameForSetter(AnnotatedMethod am, boolean stdNaming) { String name = okNameForMutator(am, "set", stdNaming); if ((name != null) // 26-Nov-2009, tatu: need to suppress this internal groovy method && (!"metaClass".equals(name) || !isGroovyMetaClassSetter(am

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>))) { return name; } return null; } /** * @since 2.5 */ public static String okNameForMutator(AnnotatedMethod am, String prefix, boolean stdNaming) { String name = am.getName(); if (name.startsWith(prefix)) { return stdNaming ? stdManglePropertyName(name, prefix.length()) : legacyManglePropertyName(name, prefix.length()); } return null; } /* /********************************************************** /* Handling property names, deprecated methods /********************************************************** */ @Deprecated // since 2.5 public static String okNameForGetter(AnnotatedMethod am) { return okNameForGetter(am, false); } @Deprecated // since 2.5 public static String okNameForRegularGetter(AnnotatedMethod am, String name) { return okNameForRegularGetter(am, name, false); } @Deprecated // since 2.5 public static String okNameForIsGetter(AnnotatedMethod am, String name) { return okNameForIsGetter(am, name, false); } @Deprecated // since 2.5 public static String okNameForSetter(AnnotatedMethod am) { return okNameForSetter(am, false); } @Deprecated // since 2.5 public static String okNameForMutator(AnnotatedMethod am, String prefix) { return okNameForMutator(am, prefix, false); } /* /********************************************************** /* Special case handling /********************************************************** */ /** * This method was added to address [JACKSON-53]: need to weed out * CGLib-injected "getCallbacks". * At this point caller has detected a potential getter method * with name "getCallbacks" and we need to determine if it is * indeed injectect by Cglib. We do this by verifying that the * result type is "net.sf.cglib.proxy.Callback[]" */ protected static boolean isCglibGetCallbacks(AnnotatedMethod am) { Class<?> rt = am.getRawType(); // Ok, first: must return an array type if (rt == null || !rt.isArray()) { return false; } /* And that type needs to be "net.sf.cglib.proxy.Callback". * Theoretically could just be a type that implements it, but * for now let's keep things simple, fix if need be. */ Class<?> compType = rt.getComponentType(); // Actually, let's just verify it's a "net.sf.cglib.*" class/interface String pkgName = ClassUtil.getPackageName(compType); if (pkgName != null) { if (pkgName.contains(".cglib")) { if (pkgName.startsWith("net.sf.cglib") // also, as per [JACKSON-1

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.type; import com.fasterxml.jackson.databind.JavaType; /** * Internal placeholder type used for self-references. * * @since 2.7 */ public class ResolvedRecursiveType extends TypeBase { private static final long serialVersionUID = 1L; protected JavaType _referencedType; public ResolvedRecursiveType(Class<?> erasedType, TypeBindings bindings) { super(erasedType, bindings, null, null, 0, null, null, false); } public void setReference(JavaType ref) { // sanity check; should not be called multiple times if (_referencedType != null) { throw new IllegalStateException("Trying to re-set self reference; old value = "+_referencedType+", new = "+ref); } _referencedType = ref; } public JavaType getSelfReferencedType() { return _referencedType; } @Override public StringBuilder getGenericSignature(StringBuilder sb) { return _referencedType.getGenericSignature(sb); } @Override public StringBuilder getErasedSignature(StringBuilder sb) { return _referencedType.getErasedSignature(sb); } @Override public JavaType withContentType(JavaType contentType) { return this; } @Override public JavaType withTypeHandler(Object h) { return this; } @Override public JavaType withContentTypeHandler(Object h) { return this; } @Override public JavaType withValueHandler(Object h) { return this; } @Override public JavaType withContentValueHandler(Object h) { return this; } @Override public JavaType withStaticTyping() { return this; } @Deprecated // since 2.7 @Override protected JavaType _narrow(Class<?> subclass) { return this; } @Override public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { return null; } @Override public boolean isContainerType() { return false; } @Override public String toString() { StringBuilder sb = new StringBuilder(40) .append("[recursive type; "); if (_referencedType == null) { sb.append("UNRESOLVED"); } else { // [databind#1301]: Typically resolves to a loop so short-cut // and only include type-erased class sb.append(_referencedType.getRawClass().getName()); } return sb.toString(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; return ((ResolvedRecursiveType) o).getSelfReferencedType().equals(getSelfReferencedType()); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> naming strategy, if applicable... PropertyNamingStrategy naming = _findNamingStrategy(); if (naming != null) { _renameUsing(props, naming); } /* Sort by visibility (explicit over implicit); drop all but first * of member type (getter, setter etc) if there is visibility * difference */ for (POJOPropertyBuilder property : props.values()) { property.trimByVisibility(); } /* and, if required, apply wrapper name: note, MUST be done after * annotations are merged. */ if (_config.isEnabled(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)) { _renameWithWrappers(props); } // well, almost last: there's still ordering... _sortProperties(props); _properties = props; _collected = true; } /* /********************************************************** /* Overridable internal methods, adding members /********************************************************** */ /** * Method for collecting basic information on all fields found */ protected void _addFields(Map<String, POJOPropertyBuilder> props) { final AnnotationIntrospector ai = _annotationIntrospector; /* 28-Mar-2013, tatu: For deserialization we may also want to remove * final fields, as often they won't make very good mutators... * (although, maybe surprisingly, JVM _can_ force setting of such fields!) */ final boolean pruneFinalFields = !_forSerialization && !_config.isEnabled(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS); final boolean transientAsIgnoral = _config.isEnabled(MapperFeature.PROPAGATE_TRANSIENT_MARKER); for (AnnotatedField f : _classDef.fields()) { String implName = (ai == null) ? null : ai.findImplicitPropertyName(f); if (implName == null) { implName = f.getName(); } PropertyName pn; if (ai == null) { pn = null; } else if (_forSerialization) { /* 18-Aug-2011, tatu: As per existing unit tests, we should only * use serialization annotation (@JsonSerialize) when serializing * fields, and similarly for deserialize-only annotations... so * no fallbacks in this particular case. */ pn = ai.findNameForSerialization(f); } else { pn = ai.findNameForDeserialization(f); } boolean nameExplicit = (pn != null); if (nameExplicit && pn.isEmpty()) { // empty String meaning "use default name", here just means "same as field name" pn = _propNameFromSimple(implName); nameExplicit = false; } // having explicit name means that field is visible; otherwise need to check the rules boolean visible = (pn != null); if (!visible) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> boolean visible; PropertyName pn = (ai == null) ? null : ai.findNameForSerialization(m); boolean nameExplicit = (pn != null); if (!nameExplicit) { // no explicit name; must consider implicit implName = (ai == null) ? null : ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForRegularGetter(m, m.getName(), _stdBeanNaming); } if (implName == null) { // if not, must skip implName = BeanUtil.okNameForIsGetter(m, m.getName(), _stdBeanNaming); if (implName == null) { return; } visible = _visibilityChecker.isIsGetterVisible(m); } else { visible = _visibilityChecker.isGetterVisible(m); } } else { // explicit indication of inclusion, but may be empty // we still need implicit name to link with other pieces implName = (ai == null) ? null : ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForGetter(m, _stdBeanNaming); } // if not regular getter name, use method name as is if (implName == null) { implName = m.getName(); } if (pn.isEmpty()) { // !!! TODO: use PropertyName for implicit names too pn = _propNameFromSimple(implName); nameExplicit = false; } visible = true; } boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m); _property(props, implName).addGetter(m, pn, nameExplicit, visible, ignore); } protected void _addSetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m, AnnotationIntrospector ai) { String implName; // from naming convention boolean visible; PropertyName pn = (ai == null) ? null : ai.findNameForDeserialization(m); boolean nameExplicit = (pn != null); if (!nameExplicit) { // no explicit name; must follow naming convention implName = (ai == null) ? null : ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForMutator(m, _mutatorPrefix, _stdBeanNaming); } if (implName == null) { // if not, must skip return; } visible = _visibilityChecker.isSetterVisible(m); } else { // explicit indication of inclusion, but may be empty // we still need implicit name to link with other pieces implName = (ai == null) ? null : ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForMutator(m, _

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>mutatorPrefix, _stdBeanNaming); } // if not regular getter name, use method name as is if (implName == null) { implName = m.getName(); } if (pn.isEmpty()) { // !!! TODO: use PropertyName for implicit names too pn = _propNameFromSimple(implName); nameExplicit = false; } visible = true; } boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m); _property(props, implName).addSetter(m, pn, nameExplicit, visible, ignore); } protected void _addInjectables(Map<String, POJOPropertyBuilder> props) { final AnnotationIntrospector ai = _annotationIntrospector; if (ai == null) { return; } // first fields, then methods for (AnnotatedField f : _classDef.fields()) { _doAddInjectable(ai.findInjectableValueId(f), f); } for (AnnotatedMethod m : _classDef.memberMethods()) { /* for now, only allow injection of a single arg * (to be changed in future) */ if (m.getParameterCount() != 1) { continue; } _doAddInjectable(ai.findInjectableValueId(m), m); } } protected void _doAddInjectable(Object id, AnnotatedMember m) { if (id == null) { return; } if (_injectables == null) { _injectables = new LinkedHashMap<Object, AnnotatedMember>(); } AnnotatedMember prev = _injectables.put(id, m); if (prev != null) { String type = id.getClass().getName(); throw new IllegalArgumentException("Duplicate injectable value with id '" +String.valueOf(id)+"' (of type "+type+")"); } } private PropertyName _propNameFromSimple(String simpleName) { return PropertyName.construct(simpleName, null); } /* /********************************************************** /* Internal methods; removing ignored properties /********************************************************** */ /** * Method called to get rid of candidate properties that are marked * as ignored. */ protected void _removeUnwantedProperties(Map<String, POJOPropertyBuilder> props) { Iterator<POJOPropertyBuilder> it = props.values().iterator(); while (it.hasNext()) { POJOPropertyBuilder prop = it.next(); // First: if nothing visible, just remove altogether if (!prop.anyVisible()) { it.remove(); continue; } // Otherwise, check ignorals if (prop.anyIgnorals()) { // first: if one or more ignorals, and no explicit markers, remove the whole thing if (!prop.isExplicitlyIncluded()) { it.remove(); _collectIgnorals(prop.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>getName()); continue; } // otherwise just remove ones marked to be ignored prop.removeIgnored(); if (!_forSerialization && !prop.couldDeserialize()) { _collectIgnorals(prop.getName()); } } } } /** * Method called to further get rid of unwanted individual accessors, * based on read/write settings and rules for "pulling in" accessors * (or not). */ protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props) { final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS); Iterator<POJOPropertyBuilder> it = props.values().iterator(); while (it.hasNext()) { POJOPropertyBuilder prop = it.next(); prop.removeNonVisible(inferMutators); } } /** * Helper method called to add explicitly ignored properties to a list * of known ignored properties; this helps in proper reporting of * errors. */ private void _collectIgnorals(String name) { if (!_forSerialization) { if (_ignoredPropertyNames == null) { _ignoredPropertyNames = new HashSet<String>(); } _ignoredPropertyNames.add(name); } } /* /********************************************************** /* Internal methods; renaming properties /********************************************************** */ protected void _renameProperties(Map<String, POJOPropertyBuilder> props) { // With renaming need to do in phases: first, find properties to rename Iterator<Map.Entry<String,POJOPropertyBuilder>> it = props.entrySet().iterator(); LinkedList<POJOPropertyBuilder> renamed = null; while (it.hasNext()) { Map.Entry<String, POJOPropertyBuilder> entry = it.next(); POJOPropertyBuilder prop = entry.getValue(); Collection<PropertyName> l = prop.findExplicitNames(); // no explicit names? Implicit one is fine as is if (l.isEmpty()) { continue; } it.remove(); // need to replace with one or more renamed if (renamed == null) { renamed = new LinkedList<POJOPropertyBuilder>(); } // simple renaming? Just do it if (l.size() == 1) { PropertyName n = l.iterator().next(); renamed.add(prop.withName(n)); continue; } // but this may be problematic... renamed.addAll(prop.explode(l)); /* String newName = prop.findNewName(); if (newName != null) { if (renamed == null) { renamed = new LinkedList<POJOPropertyBuilder>(); } prop = prop.withSimpleName(newName); renamed.add(prop); it.remove(); } */ } // and if any were renamed, merge back in... if (renamed != null) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> for (POJOPropertyBuilder prop : renamed) { String name = prop.getName(); POJOPropertyBuilder old = props.get(name); if (old == null) { props.put(name, prop); } else { old.addAll(prop); } // replace the creatorProperty too, if there is one _updateCreatorProperty(prop, _creatorProperties); } } } protected void _renameUsing(Map<String, POJOPropertyBuilder> propMap, PropertyNamingStrategy naming) { POJOPropertyBuilder[] props = propMap.values().toArray(new POJOPropertyBuilder[propMap.size()]); propMap.clear(); for (POJOPropertyBuilder prop : props) { PropertyName fullName = prop.getFullName(); String rename = null; // As per [databind#428] need to skip renaming if property has // explicitly defined name, unless feature is enabled if (!prop.isExplicitlyNamed() || _config.isEnabled(MapperFeature.ALLOW_EXPLICIT_PROPERTY_RENAMING)) { if (_forSerialization) { if (prop.hasGetter()) { rename = naming.nameForGetterMethod(_config, prop.getGetter(), fullName.getSimpleName()); } else if (prop.hasField()) { rename = naming.nameForField(_config, prop.getField(), fullName.getSimpleName()); } } else { if (prop.hasSetter()) { rename = naming.nameForSetterMethod(_config, prop.getSetter(), fullName.getSimpleName()); } else if (prop.hasConstructorParameter()) { rename = naming.nameForConstructorParameter(_config, prop.getConstructorParameter(), fullName.getSimpleName()); } else if (prop.hasField()) { rename = naming.nameForField(_config, prop.getField(), fullName.getSimpleName()); } else if (prop.hasGetter()) { /* Plus, when getter-as-setter is used, need to convert that too.. * (should we verify that's enabled? For now, assume it's ok always) */ rename = naming.nameForGetterMethod(_config, prop.getGetter(), fullName.getSimpleName()); } } } final String simpleName; if (rename != null && !fullName.hasSimpleName(rename)) { prop = prop.withSimpleName(rename); simpleName = rename; } else { simpleName = fullName.getSimpleName(); } /* As per [JACKSON-687], need to consider case where there may already be * something in there... */ POJOPropertyBuilder old = propMap.get(simpleName); if (old == null) { propMap.put(simpleName, prop); } else { old.addAll(prop); } // replace the creatorProperty too, if there is one _updateCreatorProperty(prop, _creatorProperties); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> protected void _renameWithWrappers(Map<String, POJOPropertyBuilder> props) { /* 11-Sep-2012, tatu: To support 'MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME', * need another round of renaming... */ Iterator<Map.Entry<String,POJOPropertyBuilder>> it = props.entrySet().iterator(); LinkedList<POJOPropertyBuilder> renamed = null; while (it.hasNext()) { Map.Entry<String, POJOPropertyBuilder> entry = it.next(); POJOPropertyBuilder prop = entry.getValue(); AnnotatedMember member = prop.getPrimaryMember(); if (member == null) { continue; } PropertyName wrapperName = _annotationIntrospector.findWrapperName(member); // One trickier part (wrt [Issue#24] of JAXB annotations: wrapper that // indicates use of actual property... But hopefully has been taken care // of previously if (wrapperName == null || !wrapperName.hasSimpleName()) { continue; } if (!wrapperName.equals(prop.getFullName())) { if (renamed == null) { renamed = new LinkedList<POJOPropertyBuilder>(); } prop = prop.withName(wrapperName); renamed.add(prop); it.remove(); } } // and if any were renamed, merge back in... if (renamed != null) { for (POJOPropertyBuilder prop : renamed) { String name = prop.getName(); POJOPropertyBuilder old = props.get(name); if (old == null) { props.put(name, prop); } else { old.addAll(prop); } } } } /* /********************************************************** /* Overridable internal methods, sorting, other stuff /********************************************************** */ /* First, order by [JACKSON-90] (explicit ordering and/or alphabetic) * and then for [JACKSON-170] (implicitly order creator properties before others) */ protected void _sortProperties(Map<String, POJOPropertyBuilder> props) { // Then how about explicit ordering? AnnotationIntrospector intr = _annotationIntrospector; boolean sort; Boolean alpha = (intr == null) ? null : intr.findSerializationSortAlphabetically((Annotated) _classDef); if (alpha == null) { sort = _config.shouldSortPropertiesAlphabetically(); } else { sort = alpha.booleanValue(); } String[] propertyOrder = (intr == null) ? null : intr.findSerializationPropertyOrder(_classDef); // no sorting? no need to shuffle, then if (!sort && (_creatorProperties == null) && (propertyOrder == null)) { return; } int size = props.size(); Map<String, POJOPropertyBuilder

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>> all; // Need to (re)sort alphabetically? if (sort) { all = new TreeMap<String,POJOPropertyBuilder>(); } else { all = new LinkedHashMap<String,POJOPropertyBuilder>(size+size); } for (POJOPropertyBuilder prop : props.values()) { all.put(prop.getName(), prop); } Map<String,POJOPropertyBuilder> ordered = new LinkedHashMap<String,POJOPropertyBuilder>(size+size); // Ok: primarily by explicit order if (propertyOrder != null) { for (String name : propertyOrder) { POJOPropertyBuilder w = all.get(name); if (w == null) { // also, as per [JACKSON-268], we will allow use of "implicit" names for (POJOPropertyBuilder prop : props.values()) { if (name.equals(prop.getInternalName())) { w = prop; // plus re-map to external name, to avoid dups: name = prop.getName(); break; } } } if (w != null) { ordered.put(name, w); } } } // And secondly by sorting Creator properties before other unordered properties if (_creatorProperties != null) { /* As per [databind#311], this is bit delicate; but if alphabetic ordering * is mandated, at least ensure creator properties are in alphabetic * order. Related question of creator vs non-creator is punted for now, * so creator properties still fully predate non-creator ones. */ Collection<POJOPropertyBuilder> cr; if (sort) { TreeMap<String, POJOPropertyBuilder> sorted = new TreeMap<String,POJOPropertyBuilder>(); for (POJOPropertyBuilder prop : _creatorProperties) { sorted.put(prop.getName(), prop); } cr = sorted.values(); } else { cr = _creatorProperties; } for (POJOPropertyBuilder prop : cr) { ordered.put(prop.getName(), prop); } } // And finally whatever is left (trying to put again will not change ordering) ordered.putAll(all); props.clear(); props.putAll(ordered); } /* /********************************************************** /* Internal methods; helpers /********************************************************** */ protected void reportProblem(String msg) { throw new IllegalArgumentException("Problem with definition of "+_classDef+": "+msg); } protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props, PropertyName name) { return _property(props, name.getSimpleName()); } // !!! TODO: deprecate, require use of PropertyName protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props, String implName) { POJO

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>PropertyBuilder prop = props.get(implName); if (prop == null) { prop = new POJOPropertyBuilder(_config, _annotationIntrospector, _forSerialization, PropertyName.construct(implName)); props.put(implName, prop); } return prop; } private PropertyNamingStrategy _findNamingStrategy() { Object namingDef = (_annotationIntrospector == null)? null : _annotationIntrospector.findNamingStrategy(_classDef); if (namingDef == null) { return _config.getPropertyNamingStrategy(); } if (namingDef instanceof PropertyNamingStrategy) { return (PropertyNamingStrategy) namingDef; } /* Alas, there's no way to force return type of "either class * X or Y" -- need to throw an exception after the fact */ if (!(namingDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned PropertyNamingStrategy definition of type " +namingDef.getClass().getName()+"; expected type PropertyNamingStrategy or Class<PropertyNamingStrategy> instead"); } Class<?> namingClass = (Class<?>)namingDef; // 09-Nov-2015, tatu: Need to consider pseudo-value of STD, which means "use default" if (namingClass == PropertyNamingStrategy.class) { return null; } if (!PropertyNamingStrategy.class.isAssignableFrom(namingClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class " +namingClass.getName()+"; expected Class<PropertyNamingStrategy>"); } HandlerInstantiator hi = _config.getHandlerInstantiator(); if (hi != null) { PropertyNamingStrategy pns = hi.namingStrategyInstance(_config, _classDef, namingClass); if (pns != null) { return pns; } } return (PropertyNamingStrategy) ClassUtil.createInstance(namingClass, _config.canOverrideAccessModifiers()); } protected void _updateCreatorProperty(POJOPropertyBuilder prop, List<POJOPropertyBuilder> creatorProperties) { if (creatorProperties != null) { for (int i = 0, len = creatorProperties.size(); i < len; ++i) { if (creatorProperties.get(i).getInternalName().equals(prop.getInternalName())) { creatorProperties.set(i, prop); break; } } } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> return _elementType.getValueHandler(); } @Override public Object getContentTypeHandler() { return _elementType.getTypeHandler(); } @Override public StringBuilder getErasedSignature(StringBuilder sb) { return _classSignature(_class, sb, true); } @Override public StringBuilder getGenericSignature(StringBuilder sb) { _classSignature(_class, sb, false); sb.append('<'); _elementType.getGenericSignature(sb); sb.append(">;"); return sb; } @Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); if (_elementType != null) { sb.append('<'); sb.append(_elementType.toCanonical()); sb.append('>'); } return sb.toString(); } /* /********************************************************** /* Extended API /********************************************************** */ /** * Method that can be used for checking whether this type is a * "real" Collection type; meaning whether it represents a parameterized * subtype of {@link java.util.Collection} or just something that acts * like one. */ public boolean isTrueCollectionType() { return Collection.class.isAssignableFrom(_class); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; CollectionLikeType other = (CollectionLikeType) o; return (_class == other._class) && _elementType.equals(other._elementType); } @Override public String toString() { return "[collection-like type; class "+_class.getName()+", contains "+_elementType+"]"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> return _delegate.getMember(); } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException { JsonToken t = jp.getCurrentToken(); Object value; if (t == JsonToken.VALUE_NULL) { value = _valueDeserializer.getNullValue(ctxt); } else if (_valueTypeDeserializer != null) { value = _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer); } else { // the usual case try { value = _creator.newInstance(bean); } catch (Exception e) { ClassUtil.unwrapAndThrowAsIAE(e, "Failed to instantiate class "+_creator.getDeclaringClass().getName()+", problem: "+e.getMessage()); value = null; } _valueDeserializer.deserialize(jp, ctxt, value); } set(bean, value); } @Override public Object deserializeSetAndReturn(JsonParser jp, DeserializationContext ctxt, Object instance) throws IOException { return setAndReturn(instance, deserialize(jp, ctxt)); } @Override public final void set(Object instance, Object value) throws IOException { _delegate.set(instance, value); } @Override public Object setAndReturn(Object instance, Object value) throws IOException { return _delegate.setAndReturn(instance, value); } /* /********************************************************** /* JDK serialization handling /********************************************************** */ // When reading things back, Object readResolve() { return new InnerClassProperty(this, _annotated); } Object writeReplace() { // need to construct a fake instance to support serialization if (_annotated != null) { return this; } return new InnerClassProperty(this, new AnnotatedConstructor(null, _creator, null, null)); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler; import com.fasterxml.jackson.databind.deser.Deserializers; import com.fasterxml.jackson.databind.deser.KeyDeserializers; import com.fasterxml.jackson.databind.deser.ValueInstantiators; import com.fasterxml.jackson.databind.introspect.ClassIntrospector; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; import com.fasterxml.jackson.databind.ser.Serializers; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.databind.type.TypeModifier; /** * Simple interface for extensions that can be registered with {@link ObjectMapper} * to provide a well-defined set of extensions to default functionality; such as * support for new data types. */ public abstract class Module implements Versioned { /* /********************************************************** /* Simple accessors /********************************************************** */ /** * Method that returns a display that can be used by Jackson * for informational purposes, as well as in associating extensions with * module that provides them. */ public abstract String getModuleName(); /** * Method that returns version of this module. Can be used by Jackson for * informational purposes. */ @Override public abstract Version version(); /** * Method that returns an id that may be used to determine if two {@link Module} * instances are considered to be of same type, for purpose of preventing * multiple registrations of "same type of" module * (see {@link com.fasterxml.jackson.databind.MapperFeature#IGNORE_DUPLICATE_MODULE_REGISTRATIONS}) * If `null` is returned, every instance is considered unique. * If non-null value is returned, equality of id Objects is used to check whether * modules should be considered to be "of same type" *<p> * Default implementation returns value of class name ({@link Class#getName}). * * @since 2.5 */ public Object getTypeId() { return getClass().getName(); } /* /********************************************************** /* Life-cycle: registration /********************************************************** */ /** * Method called by {@link ObjectMapper} when module is registered. * It is called to let module register functionality it provides, * using callback methods passed-in context object exposes. */ public abstract void setupModule(SetupContext context); /* /********************************************************** /* Helper types /********************************************************** */ /** * Interface Jackson exposes to modules for purpose of registering * extended functionality. * Usually implemented by {@link ObjectMapper}, but modules should *

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } } // Two-phase lookup: first using context ClassLoader; then default Throwable prob = null; ClassLoader loader = this.getClassLoader(); if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader != null) { try { return classForName(className, true, loader); } catch (Exception e) { prob = ClassUtil.getRootCause(e); } } try { return classForName(className); } catch (Exception e) { if (prob == null) { prob = ClassUtil.getRootCause(e); } } if (prob instanceof RuntimeException) { throw (RuntimeException) prob; } throw new ClassNotFoundException(prob.getMessage(), prob); } protected Class<?> classForName(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException { return Class.forName(name, true, loader); } protected Class<?> classForName(String name) throws ClassNotFoundException { return Class.forName(name); } protected Class<?> _findPrimitive(String className) { if ("int".equals(className)) return Integer.TYPE; if ("long".equals(className)) return Long.TYPE; if ("float".equals(className)) return Float.TYPE; if ("double".equals(className)) return Double.TYPE; if ("boolean".equals(className)) return Boolean.TYPE; if ("byte".equals(className)) return Byte.TYPE; if ("char".equals(className)) return Character.TYPE; if ("short".equals(className)) return Short.TYPE; if ("void".equals(className)) return Void.TYPE; return null; } /* /********************************************************** /* Type conversion, parameterization resolution methods /********************************************************** */ /** * Factory method for creating a subtype of given base type, as defined * by specified subclass; but retaining generic type information if any. * Can be used, for example, to get equivalent of "HashMap&lt;String,Integer&gt;" * from "Map&lt;String,Integer&gt;" by giving <code>HashMap.class</code> * as subclass. */ public JavaType constructSpecializedType(JavaType baseType, Class<?> subclass) { // simple optimization to avoid costly introspection if type-erased type does NOT differ final Class<?> rawBase = baseType.getRawClass(); if (rawBase == subclass) { return baseType; } JavaType newType; // also: if we start from untyped, not much to save do { // bogus loop to be able to break if (rawBase == Object.class) { newType = _fromClass(null, subclass, TypeBindings.emptyBindings()); break; } if (!rawBase.isAssignableFrom(subclass)) { throw new IllegalArgumentException(String.format( "

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Class %s not subtype of %s", subclass.getName(), baseType)); } // A few special cases where we can simplify handling: // (1) Original target type has no generics -- just resolve subtype if (baseType.getBindings().isEmpty()) { newType = _fromClass(null, subclass, TypeBindings.emptyBindings()); break; } // (2) A small set of "well-known" List/Map subtypes where can take a short-cut if (baseType.isContainerType()) { if (baseType.isMapLikeType()) { if ((subclass == HashMap.class) || (subclass == LinkedHashMap.class) || (subclass == EnumMap.class) || (subclass == TreeMap.class)) { newType = _fromClass(null, subclass, TypeBindings.create(subclass, baseType.getKeyType(), baseType.getContentType())); break; } } else if (baseType.isCollectionLikeType()) { if ((subclass == ArrayList.class) || (subclass == LinkedList.class) || (subclass == HashSet.class) || (subclass == TreeSet.class)) { newType = _fromClass(null, subclass, TypeBindings.create(subclass, baseType.getContentType())); break; } // 29-Oct-2015, tatu: One further shortcut: there are variants of `EnumSet`, // but they are impl details and we basically do not care... if (rawBase == EnumSet.class) { return baseType; } } } // (3) Sub-class does not take type parameters -- just resolve subtype int typeParamCount = subclass.getTypeParameters().length; if (typeParamCount == 0) { newType = _fromClass(null, subclass, TypeBindings.emptyBindings()); break; } // If not, we'll need to do more thorough forward+backwards resolution. Sigh. // !!! TODO (as of 28-Jan-2016, at least) // 20-Oct-2015, tatu: Container, Map-types somewhat special. There is // a way to fully resolve and merge hierarchies; but that gets expensive // so let's, for now, try to create close-enough approximation that // is not 100% same, structurally, but has equivalent information for // our specific neeeds. // 29-Mar-2016, tatu: See [databind#1173] (and test `TypeResolverTest`) // for a case where this code does get invoked: not ideal // 29-Jun-2016, tatu: As to bindings, this works for [databind#1215], but // not certain it would reliably work

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(subclass, baseType.containedType(0)); } if (typeParamCount == 2) { return TypeBindings.create(subclass, baseType.containedType(0), baseType.containedType(1)); } List<JavaType> types = new ArrayList<JavaType>(baseCount); for (int i = 0; i < baseCount; ++i) { types.add(baseType.containedType(i)); } return TypeBindings.create(subclass, types); } // Otherwise, two choices: match N first, or empty. Do latter, for now return TypeBindings.emptyBindings(); } /** * Method similar to {@link #constructSpecializedType}, but that creates a * less-specific type of given type. Usually this is as simple as simply * finding super-type with type erasure of <code>superClass</code>, but * there may be need for some additional work-arounds. * * @param superClass * * @since 2.7 */ public JavaType constructGeneralizedType(JavaType baseType, Class<?> superClass) { // simple optimization to avoid costly introspection if type-erased type does NOT differ final Class<?> rawBase = baseType.getRawClass(); if (rawBase == superClass) { return baseType; } JavaType superType = baseType.findSuperType(superClass); if (superType == null) { // Most likely, caller did not verify sub/super-type relationship if (!superClass.isAssignableFrom(rawBase)) { throw new IllegalArgumentException(String.format( "Class %s not a super-type of %s", superClass.getName(), baseType)); } // 01-Nov-2015, tatu: Should never happen, but ch throw new IllegalArgumentException(String.format( "Internal error: class %s not included as super-type for %s", superClass.getName(), baseType)); } return superType; } /** * Factory method for constructing a {@link JavaType} out of its canonical * representation (see {@link JavaType#toCanonical()}). * * @param canonical Canonical string representation of a type * * @throws IllegalArgumentException If canonical representation is malformed, * or class that type represents (including its generic parameters) is * not found */ public JavaType constructFromCanonical(String canonical) throws IllegalArgumentException { return _parser.parse(canonical); } /** * Method that is to figure out actual type parameters that given * class binds to generic types defined by given (generic) * interface or class. * This could mean, for example, trying to figure out * key and value types for Map implementations. * * @param type Sub-type (leaf type) that implements <code>expType</code> */ public JavaType

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> construct "raw" Map-like type; meaning that its * parameterization is unknown. * This is similar to using <code>Object.class</code> parameterization, * and is equivalent to calling: *<pre> * typeFactory.constructMapLikeType(collectionClass, typeFactory.unknownType(), typeFactory.unknownType()); *</pre> *<p> * This method should only be used if parameterization is completely unavailable. */ public MapLikeType constructRawMapLikeType(Class<?> mapClass) { return constructMapLikeType(mapClass, unknownType(), unknownType()); } /* /********************************************************** /* Low-level factory methods /********************************************************** */ private JavaType _mapType(Class<?> rawClass, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { JavaType kt, vt; // 28-May-2015, tatu: Properties are special, as per [databind#810]; fake "correct" parameter sig if (rawClass == Properties.class) { kt = vt = CORE_TYPE_STRING; } else { List<JavaType> typeParams = bindings.getTypeParameters(); // ok to have no types ("raw") switch (typeParams.size()) { case 0: // acceptable? kt = vt = _unknownType(); break; case 2: kt = typeParams.get(0); vt = typeParams.get(1); break; default: throw new IllegalArgumentException("Strange Map type "+rawClass.getName()+": can not determine type parameters"); } } return MapType.construct(rawClass, bindings, superClass, superInterfaces, kt, vt); } private JavaType _collectionType(Class<?> rawClass, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { List<JavaType> typeParams = bindings.getTypeParameters(); // ok to have no types ("raw") JavaType ct; if (typeParams.isEmpty()) { ct = _unknownType(); } else if (typeParams.size() == 1) { ct = typeParams.get(0); } else { throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters"); } return CollectionType.construct(rawClass, bindings, superClass, superInterfaces, ct); } private JavaType _referenceType(Class<?> rawClass, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { List<JavaType> typeParams = bindings.getTypeParameters(); // ok to have no types ("raw") JavaType ct; if (typeParams.isEmpty()) { ct = _unknownType(); } else if (typeParams.size() == 1) { ct = typeParams.get(0); } else { throw new IllegalArgumentException("

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Strange Reference type "+rawClass.getName()+": can not determine type parameters"); } return ReferenceType.construct(rawClass, bindings, superClass, superInterfaces, ct); } /** * Factory method to call when no special {@link JavaType} is needed, * no generic parameters are passed. Default implementation may check * pre-constructed values for "well-known" types, but if none found * will simply call {@link #_newSimpleType} * * @since 2.7 */ protected JavaType _constructSimple(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { if (bindings.isEmpty()) { JavaType result = _findWellKnownSimple(raw); if (result != null) { return result; } } return _newSimpleType(raw, bindings, superClass, superInterfaces); } /** * Factory method that is to create a new {@link SimpleType} with no * checks whatsoever. Default implementation calls the single argument * constructor of {@link SimpleType}. * * @since 2.7 */ protected JavaType _newSimpleType(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) { return new SimpleType(raw, bindings, superClass, superInterfaces); } protected JavaType _unknownType() { /* 15-Sep-2015, tatu: Prior to 2.7, we constructed new instance for each call. * This may have been due to potential mutability of the instance; but that * should not be issue any more, and creation is somewhat wasteful. So let's * try reusing singleton/flyweight instance. */ return CORE_TYPE_OBJECT; } /** * Helper method called to see if requested, non-generic-parameterized * type is one of common, "well-known" types, instances of which are * pre-constructed and do not need dynamic caching. * * @since 2.7 */ protected JavaType _findWellKnownSimple(Class<?> clz) { if (clz.isPrimitive()) { if (clz == CLS_BOOL) return CORE_TYPE_BOOL; if (clz == CLS_INT) return CORE_TYPE_INT; if (clz == CLS_LONG) return CORE_TYPE_LONG; } else { if (clz == CLS_STRING) return CORE_TYPE_STRING; if (clz == CLS_OBJECT) return CORE_TYPE_OBJECT; // since 2.7 } return null; } /* /********************************************************** /* Actual type resolution, traversal /********************************************************** */ /** * Factory method that can be used if type information is passed * as Java typing returned from <code>getGenericX

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>xx</code> methods * (usually for a return or argument type). */ protected JavaType _fromAny(ClassStack context, Type type, TypeBindings bindings) { JavaType resultType; // simple class? if (type instanceof Class<?>) { // Important: remove possible bindings since this is type-erased thingy resultType = _fromClass(context, (Class<?>) type, EMPTY_BINDINGS); } // But if not, need to start resolving. else if (type instanceof ParameterizedType) { resultType = _fromParamType(context, (ParameterizedType) type, bindings); } else if (type instanceof JavaType) { // [databind#116] // no need to modify further if we already had JavaType return (JavaType) type; } else if (type instanceof GenericArrayType) { resultType = _fromArrayType(context, (GenericArrayType) type, bindings); } else if (type instanceof TypeVariable<?>) { resultType = _fromVariable(context, (TypeVariable<?>) type, bindings); } else if (type instanceof WildcardType) { resultType = _fromWildcard(context, (WildcardType) type, bindings); } else { // sanity check throw new IllegalArgumentException("Unrecognized Type: "+((type == null) ? "[null]" : type.toString())); } /* 21-Feb-2016, nateB/tatu: as per [databind#1129] (applied for 2.7.2), * we do need to let all kinds of types to be refined, esp. for Scala module. */ if (_modifiers != null) { TypeBindings b = resultType.getBindings(); if (b == null) { b = EMPTY_BINDINGS; } for (TypeModifier mod : _modifiers) { JavaType t = mod.modifyType(resultType, type, b, this); if (t == null) { throw new IllegalStateException(String.format( "TypeModifier %s (of type %s) return null for type %s", mod, mod.getClass().getName(), resultType)); } resultType = t; } } return resultType; } /** * @param bindings Mapping of formal parameter declarations (for generic * types) into actual types */ protected JavaType _fromClass(ClassStack context, Class<?> rawType, TypeBindings bindings) { // Very first thing: small set of core types we know well: JavaType result = _findWellKnownSimple(rawType); if (result != null) { return result; } // Barring that, we may have recently constructed an instance final Object key; if ((bindings == null) || bindings.isEmpty()) { key = rawType; result = _typeCache.get(key);

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> protected JavaType _fromParamType(ClassStack context, ParameterizedType ptype, TypeBindings parentBindings) { // Assumption here is we'll always get Class, not one of other Types Class<?> rawType = (Class<?>) ptype.getRawType(); // 29-Oct-2015, tatu: For performance reasons, let's streamline handling of // couple of not-so-useful parametric types if (rawType == CLS_ENUM) { return CORE_TYPE_ENUM; } if (rawType == CLS_COMPARABLE) { return CORE_TYPE_COMPARABLE; } if (rawType == CLS_CLASS) { return CORE_TYPE_CLASS; } // First: what is the actual base type? One odd thing is that 'getRawType' // returns Type, not Class<?> as one might expect. But let's assume it is // always of type Class: if not, need to add more code to resolve it to Class. Type[] args = ptype.getActualTypeArguments(); int paramCount = (args == null) ? 0 : args.length; JavaType[] pt; TypeBindings newBindings; if (paramCount == 0) { newBindings = EMPTY_BINDINGS; } else { pt = new JavaType[paramCount]; for (int i = 0; i < paramCount; ++i) { pt[i] = _fromAny(context, args[i], parentBindings); } newBindings = TypeBindings.create(rawType, pt); } return _fromClass(context, rawType, newBindings); } protected JavaType _fromArrayType(ClassStack context, GenericArrayType type, TypeBindings bindings) { JavaType elementType = _fromAny(context, type.getGenericComponentType(), bindings); return ArrayType.construct(elementType, bindings); } protected JavaType _fromVariable(ClassStack context, TypeVariable<?> var, TypeBindings bindings) { // ideally should find it via bindings: final String name = var.getName(); JavaType type = bindings.findBoundType(name); if (type != null) { return type; } // but if not, use bounds... note that approach here is simplistic; not taking // into account possible multiple bounds, nor consider upper bounds. if (bindings.hasUnbound(name)) { return CORE_TYPE_OBJECT; } bindings = bindings.withUnboundVariable(name); Type[] bounds = var.getBounds(); return _fromAny(context, bounds[0], bindings); } protected JavaType _fromWildcard(ClassStack context, WildcardType type, TypeBindings bindings) { /* Similar to challenges with TypeVariable, we may have multiple upper bounds. * But it is also possible that if upper bound defaults to Object

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; import java.lang.reflect.Type; import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonSerializable; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.type.TypeFactory; /** * Generic handler for types that implement {@link JsonSerializable}. *<p> * Note: given that this is used for anything that implements * interface, can not be checked for direct class equivalence. */ @JacksonStdImpl @SuppressWarnings("serial") public class SerializableSerializer extends StdSerializer<JsonSerializable> { public final static SerializableSerializer instance = new SerializableSerializer(); // Ugh. Should NOT need this... private final static AtomicReference<ObjectMapper> _mapperReference = new AtomicReference<ObjectMapper>(); protected SerializableSerializer() { super(JsonSerializable.class); } @Override public boolean isEmpty(SerializerProvider serializers, JsonSerializable value) { if (value instanceof JsonSerializable.Base) { return ((JsonSerializable.Base) value).isEmpty(serializers); } return false; } @Override public void serialize(JsonSerializable value, JsonGenerator gen, SerializerProvider serializers) throws IOException { value.serialize(gen, serializers); } @Override public final void serializeWithType(JsonSerializable value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { value.serializeWithType(gen, serializers, typeSer); } @Override @SuppressWarnings("deprecation") public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { ObjectNode objectNode = createObjectNode(); String schemaType = "any"; String objectProperties = null; String itemDefinition = null; if (typeHint != null) { Class<?> rawClass = TypeFactory.rawClass(typeHint); if (rawClass.isAnnotationPresent(JsonSerializableSchema.class)) { JsonSerializableSchema schemaInfo = rawClass.getAnnotation(JsonSerializableSchema.class); schemaType = schemaInfo.schemaType(); if (!JsonSerializableSchema.NO_VALUE.equals(schemaInfo.schemaObjectPropertiesDefinition())) {

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> objectProperties = schemaInfo.schemaObjectPropertiesDefinition(); } if (!JsonSerializableSchema.NO_VALUE.equals(schemaInfo.schemaItemDefinition())) { itemDefinition = schemaInfo.schemaItemDefinition(); } } } /* 19-Mar-2012, tatu: geez, this is butt-ugly abonimation of code... * really, really should not require back ref to an ObjectMapper. */ objectNode.put("type", schemaType); if (objectProperties != null) { try { objectNode.set("properties", _getObjectMapper().readTree(objectProperties)); } catch (IOException e) { throw JsonMappingException.from(provider, "Failed to parse @JsonSerializableSchema.schemaObjectPropertiesDefinition value"); } } if (itemDefinition != null) { try { objectNode.set("items", _getObjectMapper().readTree(itemDefinition)); } catch (IOException e) { throw JsonMappingException.from(provider, "Failed to parse @JsonSerializableSchema.schemaItemDefinition value"); } } // always optional, no need to specify: //objectNode.put("required", false); return objectNode; } private final static synchronized ObjectMapper _getObjectMapper() { ObjectMapper mapper = _mapperReference.get(); if (mapper == null) { mapper = new ObjectMapper(); _mapperReference.set(mapper); } return mapper; } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitor.expectAnyFormat(typeHint); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>. */ public abstract DefaultSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf); /** * The method to be called by {@link ObjectMapper} and {@link ObjectWriter} * for serializing given value, using serializers that * this provider has access to (via caching and/or creating new serializers * as need be). */ public void serializeValue(JsonGenerator gen, Object value) throws IOException { if (value == null) { _serializeNull(gen); return; } Class<?> cls = value.getClass(); // true, since we do want to cache root-level typed serializers (ditto for null property) final JsonSerializer<Object> ser = findTypedValueSerializer(cls, true, null); // Ok: should we wrap result in an additional property ("root name")? final boolean wrap; PropertyName rootName = _config.getFullRootName(); if (rootName == null) { // not explicitly specified // [JACKSON-163] wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE); if (wrap) { gen.writeStartObject(); PropertyName pname = _config.findRootName(value.getClass()); gen.writeFieldName(pname.simpleAsEncoded(_config)); } } else if (rootName.isEmpty()) { wrap = false; } else { // [JACKSON-764] // empty String means explicitly disabled; non-empty that it is enabled wrap = true; gen.writeStartObject(); gen.writeFieldName(rootName.getSimpleName()); } try { ser.serialize(value, gen, this); if (wrap) { gen.writeEndObject(); } } catch (IOException ioe) { // As per [JACKSON-99], pass IOException and subtypes as-is throw ioe; } catch (Exception e) { // but wrap RuntimeExceptions, to get path information String msg = e.getMessage(); if (msg == null) { msg = "[no message for "+e.getClass().getName()+"]"; } throw new JsonMappingException(gen, msg, e); } } /** * The method to be called by {@link ObjectMapper} and {@link ObjectWriter} * for serializing given value (assumed to be of specified root type, * instead of runtime type of value), * using serializers that * this provider has access to (via caching and/or creating new serializers * as need be), * * @param rootType Type to use for locating serializer to use, instead of actual * runtime type. Must be actual type, or one of its super types */ public void serializeValue(JsonGenerator gen, Object value, JavaType rootType) throws IOException { if (value == null) { _serializeNull(gen); return; } // Let's ensure

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> types are compatible at this point if (!rootType.getRawClass().isAssignableFrom(value.getClass())) { _reportIncompatibleRootType(value, rootType); } // root value, not reached via property: JsonSerializer<Object> ser = findTypedValueSerializer(rootType, true, null); // Ok: should we wrap result in an additional property ("root name")? final boolean wrap; PropertyName rootName = _config.getFullRootName(); if (rootName == null) { // not explicitly specified // [JACKSON-163] wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE); if (wrap) { gen.writeStartObject(); PropertyName pname = _config.findRootName(value.getClass()); gen.writeFieldName(pname.simpleAsEncoded(_config)); } } else if (rootName.isEmpty()) { wrap = false; } else { // [JACKSON-764] // empty String means explicitly disabled; non-empty that it is enabled wrap = true; gen.writeStartObject(); gen.writeFieldName(rootName.getSimpleName()); } try { ser.serialize(value, gen, this); if (wrap) { gen.writeEndObject(); } } catch (IOException ioe) { // no wrapping for IO (and derived) throw ioe; } catch (Exception e) { // but others do need to be, to get path etc String msg = e.getMessage(); if (msg == null) { msg = "[no message for "+e.getClass().getName()+"]"; } throw JsonMappingException.from(gen, msg, e); } } /** * The method to be called by {@link ObjectWriter} * for serializing given value (assumed to be of specified root type, * instead of runtime type of value), when it may know specific * {@link JsonSerializer} to use. * * @param rootType Type to use for locating serializer to use, instead of actual * runtime type, if no serializer is passed * @param ser Root Serializer to use, if not null * * @since 2.1 */ public void serializeValue(JsonGenerator gen, Object value, JavaType rootType, JsonSerializer<Object> ser) throws IOException { if (value == null) { _serializeNull(gen); return; } // Let's ensure types are compatible at this point if ((rootType != null) && !rootType.getRawClass().isAssignableFrom(value.getClass())) { _reportIncompatibleRootType(value, rootType); } // root value, not reached via property: if (ser == null) { ser = findTypedValueSerializer(rootType, true, null); } // Ok: should we wrap result in an additional property ("root name")? final boolean

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> wrap; PropertyName rootName = _config.getFullRootName(); if (rootName == null) { // not explicitly specified // [JACKSON-163] wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE); if (wrap) { gen.writeStartObject(); PropertyName pname = (rootType == null) ? _config.findRootName(value.getClass()) : _config.findRootName(rootType); gen.writeFieldName(pname.simpleAsEncoded(_config)); } } else if (rootName.isEmpty()) { wrap = false; } else { // [JACKSON-764] // empty String means explicitly disabled; non-empty that it is enabled wrap = true; gen.writeStartObject(); gen.writeFieldName(rootName.getSimpleName()); } try { ser.serialize(value, gen, this); if (wrap) { gen.writeEndObject(); } } catch (IOException ioe) { // no wrapping for IO (and derived) throw ioe; } catch (Exception e) { // but others do need to be, to get path etc String msg = e.getMessage(); if (msg == null) { msg = "[no message for "+e.getClass().getName()+"]"; } throw JsonMappingException.from(gen, msg, e); } } /** * Alternate serialization call used for polymorphic types, when {@link TypeSerializer} * is already known, but the actual serializer may or may not be. * * @since 2.6 */ public void serializePolymorphic(JsonGenerator gen, Object value, JavaType rootType, JsonSerializer<Object> valueSer, TypeSerializer typeSer) throws IOException { if (value == null) { _serializeNull(gen); return; } // Let's ensure types are compatible at this point if ((rootType != null) && !rootType.getRawClass().isAssignableFrom(value.getClass())) { _reportIncompatibleRootType(value, rootType); } /* 12-Jun-2015, tatu: nominal root type is necessary for Maps at least; * possibly collections, but can cause problems for other polymorphic * types. We really need to distinguish between serialization type, * base type; but right we don't. Hence this check */ if (valueSer == null) { if ((rootType != null) && rootType.isContainerType()) { valueSer = findValueSerializer(rootType, null); } else { valueSer = findValueSerializer(value.getClass(), null); } } final boolean wrap; PropertyName rootName = _config.getFullRootName(); if (rootName == null) { wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE);

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> if (wrap) { gen.writeStartObject(); PropertyName pname = _config.findRootName(value.getClass()); gen.writeFieldName(pname.simpleAsEncoded(_config)); } } else if (rootName.isEmpty()) { wrap = false; } else { wrap = true; gen.writeStartObject(); gen.writeFieldName(rootName.getSimpleName()); } try { valueSer.serializeWithType(value, gen, this, typeSer); if (wrap) { gen.writeEndObject(); } } catch (IOException ioe) { // no wrapping for IO (and derived) throw ioe; } catch (Exception e) { // but others do need to be, to get path etc String msg = e.getMessage(); if (msg == null) { msg = "[no message for "+e.getClass().getName()+"]"; } throw JsonMappingException.from(gen, msg, e); } } /** * @deprecated since 2.6; remove from 2.7 or later */ @Deprecated public void serializePolymorphic(JsonGenerator gen, Object value, TypeSerializer typeSer) throws IOException { JavaType t = (value == null) ? null : _config.constructType(value.getClass()); serializePolymorphic(gen, value, t, null, typeSer); } /** * Helper method called when root value to serialize is null * * @since 2.3 */ protected void _serializeNull(JsonGenerator gen) throws IOException { JsonSerializer<Object> ser = getDefaultNullValueSerializer(); try { ser.serialize(null, gen, this); } catch (IOException ioe) { // no wrapping for IO (and derived) throw ioe; } catch (Exception e) { // but others do need to be, to get path etc String msg = e.getMessage(); if (msg == null) { msg = "[no message for "+e.getClass().getName()+"]"; } throw JsonMappingException.from(gen, msg, e); } } /** * The method to be called by {@link ObjectMapper} * to generate <a href="http://json-schema.org/">JSON schema</a> for * given type. * * @param type The type for which to generate schema * * @deprecated Should not be used any more */ @Deprecated // since 2.6 public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class<?> type) throws JsonMappingException { if (type == null) { throw new IllegalArgumentException("A class must be provided"); } /* no need for embedded type information for JSON schema generation (all * type information it needs is accessible via "untyped" serializer) */ JsonSerializer<Object> ser = findValueSerializer(type, null); JsonNode

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> schemaNode = (ser instanceof SchemaAware) ? ((SchemaAware) ser).getSchema(this, null) : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); if (!(schemaNode instanceof ObjectNode)) { throw new IllegalArgumentException("Class " + type.getName() +" would not be serialized as a JSON object and therefore has no schema"); } return new com.fasterxml.jackson.databind.jsonschema.JsonSchema((ObjectNode) schemaNode); } /** * The method to be called by {@link ObjectMapper} and {@link ObjectWriter} * to to expose the format of the given to to the given visitor * * @param javaType The type for which to generate format * @param visitor the visitor to accept the format */ public void acceptJsonFormatVisitor(JavaType javaType, JsonFormatVisitorWrapper visitor) throws JsonMappingException { if (javaType == null) { throw new IllegalArgumentException("A class must be provided"); } /* no need for embedded type information for JSON schema generation (all * type information it needs is accessible via "untyped" serializer) */ visitor.setProvider(this); findValueSerializer(javaType, null).acceptJsonFormatVisitor(visitor, javaType); } /** * Method that can be called to see if this serializer provider * can find a serializer for an instance of given class. *<p> * Note that no Exceptions are thrown, including unchecked ones: * implementations are to swallow exceptions if necessary. */ public boolean hasSerializerFor(Class<?> cls, AtomicReference<Throwable> cause) { // 07-Nov-2015, tatu: One special case, Object.class; will work only if // empty beans are allowed or custom serializer registered. Easiest to // check here. if (cls == Object.class) { if (!_config.isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)) { return true; } } try { JsonSerializer<?> ser = _findExplicitUntypedSerializer(cls); return (ser != null); } catch (JsonMappingException e) { if (cause != null) { cause.set(e); } } catch (RuntimeException e) { if (cause == null) { // earlier behavior throw e; } cause.set(e); } return false; } /* /******************************************************** /* Access to caching details /******************************************************** */ /** * Method that can be used to determine how many serializers this * provider is caching currently * (if it does caching: default implementation does) * Exact count depends on what kind of serializers get cached; * default implementation caches all serializers, including ones that * are eagerly constructed (for optimal access speed) *<p> * The main use case for this method is to allow conditional flushing of *

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * X or Y" -- need to throw an exception after the fact */ if (!(serDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned serializer definition of type " +serDef.getClass().getName()+"; expected type JsonSerializer or Class<JsonSerializer> instead"); } Class<?> serClass = (Class<?>)serDef; // there are some known "no class" markers to consider too: if (serClass == JsonSerializer.None.class || ClassUtil.isBogusClass(serClass)) { return null; } if (!JsonSerializer.class.isAssignableFrom(serClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class " +serClass.getName()+"; expected Class<JsonSerializer>"); } HandlerInstantiator hi = _config.getHandlerInstantiator(); ser = (hi == null) ? null : hi.serializerInstance(_config, annotated, serClass); if (ser == null) { ser = (JsonSerializer<?>) ClassUtil.createInstance(serClass, _config.canOverrideAccessModifiers()); } } return (JsonSerializer<Object>) _handleResolvable(ser); } /* /********************************************************** /* Helper classes /********************************************************** */ /** * Concrete implementation that defines factory method(s), * defined as final. */ public final static class Impl extends DefaultSerializerProvider { private static final long serialVersionUID = 1L; public Impl() { super(); } public Impl(Impl src) { super(src); } protected Impl(SerializerProvider src, SerializationConfig config,SerializerFactory f) { super(src, config, f); } @Override public DefaultSerializerProvider copy() { if (getClass() != Impl.class) { return super.copy(); } return new Impl(this); } @Override public Impl createInstance(SerializationConfig config, SerializerFactory jsf) { return new Impl(this, config, jsf); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>********************************************************** */ @Deprecated @Override public boolean isEmpty(T value) { // let's assume "null date" (timestamp 0) qualifies for empty return (value == null) || (_timestamp(value) == 0L); } @Override public boolean isEmpty(SerializerProvider serializers, T value) { // let's assume "null date" (timestamp 0) qualifies for empty return (value == null) || (_timestamp(value) == 0L); } protected abstract long _timestamp(T value); @Override public JsonNode getSchema(SerializerProvider serializers, Type typeHint) { //todo: (ryan) add a format for the date in the schema? return createSchemaNode(_asTimestamp(serializers) ? "number" : "string", true); } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { _acceptJsonFormatVisitor(visitor, typeHint, _asTimestamp(visitor.getProvider())); } /* /********************************************************** /* Actual serialization /********************************************************** */ @Override public abstract void serialize(T value, JsonGenerator gen, SerializerProvider serializers) throws IOException; /* /********************************************************** /* Helper methods /********************************************************** */ protected boolean _asTimestamp(SerializerProvider serializers) { if (_useTimestamp != null) { return _useTimestamp.booleanValue(); } if (_customFormat == null) { if (serializers != null) { return serializers.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); } // 12-Jun-2014, tatu: Is it legal not to have provider? Was NPE:ing earlier so leave a check throw new IllegalArgumentException("Null SerializerProvider passed for "+handledType().getName()); } return false; } protected void _acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint, boolean asNumber) throws JsonMappingException { if (asNumber) { visitIntFormat(visitor, typeHint, JsonParser.NumberType.LONG, JsonValueFormat.UTC_MILLISEC); } else { visitStringFormat(visitor, typeHint, JsonValueFormat.DATE_TIME); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>CreateFromBoolean()) { String str = value.trim(); if ("true".equals(str)) { return createFromBoolean(ctxt, true); } if ("false".equals(str)) { return createFromBoolean(ctxt, false); } } // also, empty Strings might be accepted as null Object... if (value.length() == 0) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { return null; } } throw ctxt.mappingException("Can not instantiate value of type %s from String value ('%s'); no single-String constructor/factory method", getValueTypeDesc(), value); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.util.ClassUtil; public final class AnnotatedMethod extends AnnotatedWithParams implements java.io.Serializable { private static final long serialVersionUID = 1L; final protected transient Method _method; // // Simple lazy-caching: protected Class<?>[] _paramClasses; /** * Field that is used to make JDK serialization work with this * object. * * @since 2.1 */ protected Serialization _serialization; /* /***************************************************** /* Life-cycle /***************************************************** */ public AnnotatedMethod(TypeResolutionContext ctxt, Method method, AnnotationMap classAnn, AnnotationMap[] paramAnnotations) { super(ctxt, classAnn, paramAnnotations); if (method == null) { throw new IllegalArgumentException("Can not construct AnnotatedMethod with null Method"); } _method = method; } /** * Method used for JDK serialization support * @since 2.1 */ protected AnnotatedMethod(Serialization ser) { super(null, null, null); _method = null; _serialization = ser; } /** * Method that constructs a new instance with settings (annotations, parameter annotations) * of this instance, but with different physical {@link Method}. */ public AnnotatedMethod withMethod(Method m) { return new AnnotatedMethod(_typeContext, m, _annotations, _paramAnnotations); } @Override public AnnotatedMethod withAnnotations(AnnotationMap ann) { return new AnnotatedMethod(_typeContext, _method, ann, _paramAnnotations); } @Override public Method getAnnotated() { return _method; } @Override public int getModifiers() { return _method.getModifiers(); } @Override public String getName() { return _method.getName(); } /** * For methods, this returns declared return type, which is only * useful with getters (setters do not return anything; hence "void" * type is returned here) */ @Override public JavaType getType() { return _typeContext.resolveType(_method.getGenericReturnType()); } /** * For methods, this returns declared return type, which is only * useful with getters (setters do not usually return anything; * hence "void" type is returned here) */ @Override public Class<?> getRawType() { return _method.getReturnType(); } @Deprecated @Override public Type getGenericType() { return _method.getGenericReturnType(); } /* /***************************************************** /* AnnotatedWithParams /***************************************************** */ @Override public final Object call() throws Exception { return _method.invoke(null); } @Override public final Object call

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(Object[] args) throws Exception { return _method.invoke(null, args); } @Override public final Object call1(Object arg) throws Exception { return _method.invoke(null, arg); } /* /******************************************************** /* AnnotatedMember impl /******************************************************** */ @Override public int getParameterCount() { return getRawParameterTypes().length; } @Override public Class<?> getRawParameterType(int index) { Class<?>[] types = getRawParameterTypes(); return (index >= types.length) ? null : types[index]; } @Override public JavaType getParameterType(int index) { Type[] types = _method.getGenericParameterTypes(); if (index >= types.length) { return null; } return _typeContext.resolveType(types[index]); } @Override @Deprecated // since 2.7 public Type getGenericParameterType(int index) { Type[] types = getGenericParameterTypes(); if (index >= types.length) { return null; } return types[index]; } @Override public Class<?> getDeclaringClass() { return _method.getDeclaringClass(); } @Override public Method getMember() { return _method; } @Override public void setValue(Object pojo, Object value) throws IllegalArgumentException { try { _method.invoke(pojo, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to setValue() with method " +getFullName()+": "+e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Failed to setValue() with method " +getFullName()+": "+e.getMessage(), e); } } @Override public Object getValue(Object pojo) throws IllegalArgumentException { try { return _method.invoke(pojo); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to getValue() with method " +getFullName()+": "+e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Failed to getValue() with method " +getFullName()+": "+e.getMessage(), e); } } /* /***************************************************** /* Extended API, generic /***************************************************** */ public String getFullName() { return getDeclaringClass().getName() + "#" + getName() + "(" +getParameterCount()+" params)"; } public Class<?>[] getRawParameterTypes() { if (_paramClasses == null) { _paramClasses = _method.getParameterTypes(); } return _paramClasses; } @Deprecated // since 2.7 public Type[] getGenericParameterTypes() { return _method.getGenericParameterTypes(); } public Class<?> getRawReturnType() { return _method.getReturnType(); } /** * Helper method that can be used to check whether method

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> returns * a value or not; if return type declared as <code>void</code>, returns * false, otherwise true * * @since 2.4 */ public boolean hasReturnType() { Class<?> rt = getRawReturnType(); return (rt != Void.TYPE && rt != Void.class); } /* /******************************************************** /* Other /******************************************************** */ @Override public String toString() { return "[method "+getFullName()+"]"; } @Override public int hashCode() { return _method.getName().hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; return ((AnnotatedMethod) o)._method == _method; } /* /********************************************************** /* JDK serialization handling /********************************************************** */ Object writeReplace() { return new AnnotatedMethod(new Serialization(_method)); } Object readResolve() { Class<?> clazz = _serialization.clazz; try { Method m = clazz.getDeclaredMethod(_serialization.name, _serialization.args); // 06-Oct-2012, tatu: Has "lost" its security override, may need to force back if (!m.isAccessible()) { ClassUtil.checkAndFixAccess(m, false); } return new AnnotatedMethod(null, m, null, null); } catch (Exception e) { throw new IllegalArgumentException("Could not find method '"+_serialization.name +"' from Class '"+clazz.getName()); } } /** * Helper class that is used as the workaround to persist * Field references. It basically just stores declaring class * and field name. */ private final static class Serialization implements java.io.Serializable { private static final long serialVersionUID = 1L; protected Class<?> clazz; protected String name; protected Class<?>[] args; public Serialization(Method setter) { clazz = setter.getDeclaringClass(); name = setter.getName(); args = setter.getParameterTypes(); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser; import java.lang.reflect.Method; import java.math.BigDecimal; import java.math.BigInteger; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.util.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.cfg.SerializerFactoryConfig; import com.fasterxml.jackson.databind.ext.OptionalHandlerFactory; import com.fasterxml.jackson.databind.introspect.*; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.impl.*; import com.fasterxml.jackson.databind.ser.std.*; import com.fasterxml.jackson.databind.type.*; import com.fasterxml.jackson.databind.util.*; /** * Factory class that can provide serializers for standard JDK classes, * as well as custom classes that extend standard classes or implement * one of "well-known" interfaces (such as {@link java.util.Collection}). *<p> * Since all the serializers are eagerly instantiated, and there is * no additional introspection or customizability of these types, * this factory is essentially stateless. */ @SuppressWarnings("serial") public abstract class BasicSerializerFactory extends SerializerFactory implements java.io.Serializable { /* /********************************************************** /* Configuration, lookup tables/maps /********************************************************** */ /** * Since these are all JDK classes, we shouldn't have to worry * about ClassLoader used to load them. Rather, we can just * use the class name, and keep things simple and efficient. */ protected final static HashMap<String, JsonSerializer<?>> _concrete; /** * Actually it may not make much sense to eagerly instantiate all * kinds of serializers: so this Map actually contains class references, * not instances */ protected final static HashMap<String, Class<? extends JsonSerializer<?>>> _concreteLazy; static { HashMap<String, Class<? extends JsonSerializer<?>>> concLazy = new HashMap<String, Class<? extends JsonSerializer<?>>>(); HashMap<String, JsonSerializer<?>> concrete = new HashMap<String, JsonSerializer<?>>(); /* String and string-like types (note: date types explicitly * not included -- can use either textual or numeric serialization) */ concrete.put(String.class.getName(), new StringSerializer()); final ToStringSerializer sls = ToStringSerializer.instance; concrete.put(StringBuffer.class.getName(), sls); concrete.put(StringBuilder

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.class.getName(), sls); concrete.put(Character.class.getName(), sls); concrete.put(Character.TYPE.getName(), sls); // Primitives/wrappers for primitives (primitives needed for Beans) NumberSerializers.addAll(concrete); concrete.put(Boolean.TYPE.getName(), new BooleanSerializer(true)); concrete.put(Boolean.class.getName(), new BooleanSerializer(false)); // Other numbers, more complicated concrete.put(BigInteger.class.getName(), new NumberSerializer(BigInteger.class)); concrete.put(BigDecimal.class.getName(),new NumberSerializer(BigDecimal.class)); // Other discrete non-container types: // First, Date/Time zoo: concrete.put(Calendar.class.getName(), CalendarSerializer.instance); concrete.put(java.util.Date.class.getName(), DateSerializer.instance); // And then other standard non-structured JDK types for (Map.Entry<Class<?>,Object> en : StdJdkSerializers.all()) { Object value = en.getValue(); if (value instanceof JsonSerializer<?>) { concrete.put(en.getKey().getName(), (JsonSerializer<?>) value); } else if (value instanceof Class<?>) { @SuppressWarnings("unchecked") Class<? extends JsonSerializer<?>> cls = (Class<? extends JsonSerializer<?>>) value; concLazy.put(en.getKey().getName(), cls); } else { // should never happen, but: throw new IllegalStateException("Internal error: unrecognized value of type "+en.getClass().getName()); } } // Jackson-specific type(s) // (Q: can this ever be sub-classed?) concLazy.put(TokenBuffer.class.getName(), TokenBufferSerializer.class); _concrete = concrete; _concreteLazy = concLazy; } /* /********************************************************** /* Configuration /********************************************************** */ /** * Configuration settings for this factory; immutable instance (just like this * factory), new version created via copy-constructor (fluent-style) */ protected final SerializerFactoryConfig _factoryConfig; /* /********************************************************** /* Life cycle /********************************************************** */ /** * We will provide default constructor to allow sub-classing, * but make it protected so that no non-singleton instances of * the class will be instantiated. */ protected BasicSerializerFactory(SerializerFactoryConfig config) { _factoryConfig = (config == null) ? new SerializerFactoryConfig() : config; } /** * Method for getting current {@link SerializerFactoryConfig}. *<p> * Note that since instances are immutable, you can NOT change settings * by accessing an instance and calling methods: this will simply create * new instance of config object. */ public SerializerFactoryConfig getFactoryConfig() { return _factoryConfig; } /** * Method used for creating a new instance of this factory, but with different

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>StdKeySerializer(config, rawType, true); Method m = am.getAnnotated(); if (config.canOverrideAccessModifiers()) { ClassUtil.checkAndFixAccess(m, config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } ser = new JsonValueSerializer(m, delegate); } else { ser = StdKeySerializers.getFallbackKeySerializer(config, keyType.getRawClass()); } } } } // [databind#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyKeySerializer(config, keyType, beanDesc, ser); } } return (JsonSerializer<Object>) ser; } /** * Method called to construct a type serializer for values with given declared * base type. This is called for values other than those of bean property * types. */ @Override public TypeSerializer createTypeSerializer(SerializationConfig config, JavaType baseType) { BeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass()); AnnotatedClass ac = bean.getClassInfo(); AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType); /* Ok: if there is no explicit type info handler, we may want to * use a default. If so, config object knows what to use. */ Collection<NamedType> subtypes = null; if (b == null) { b = config.getDefaultTyper(baseType); } else { subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, ac); } if (b == null) { return null; } // 10-Jun-2015, tatu: Since not created for Bean Property, no need for post-processing // wrt EXTERNAL_PROPERTY return b.buildTypeSerializer(config, baseType, subtypes); } /* /********************************************************** /* Additional API for other core classes /********************************************************** */ protected abstract Iterable<Serializers> customSerializers(); /* /********************************************************** /* Overridable secondary serializer accessor methods /********************************************************** */ /** * Method that will use fast lookup (and identity comparison) methods to * see if we know serializer to use for given type. */ protected final JsonSerializer<?> findSerializerByLookup(JavaType type, SerializationConfig config, BeanDescription beanDesc, boolean staticTyping) { Class<?> raw = type.getRawClass(); String clsName = raw.getName(); JsonSerializer<?> ser = _concrete.get(clsName); if (ser == null) { Class<? extends JsonSerializer<?>> serClass = _concreteLazy.get(clsName); if

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> (serClass != null) { try { return serClass.newInstance(); } catch (Exception e) { throw new IllegalStateException("Failed to instantiate standard serializer (of type "+serClass.getName()+"): " +e.getMessage(), e); } } } return ser; } /** * Method called to see if one of primary per-class annotations * (or related, like implementing of {@link JsonSerializable}) * determines the serializer to use. *<p> * Currently handles things like: *<ul> * <li>If type implements {@link JsonSerializable}, use that * </li> * <li>If type has {@link com.fasterxml.jackson.annotation.JsonValue} annotation (or equivalent), build serializer * based on that property * </li> *</ul> * * @since 2.0 */ protected final JsonSerializer<?> findSerializerByAnnotations(SerializerProvider prov, JavaType type, BeanDescription beanDesc) throws JsonMappingException { Class<?> raw = type.getRawClass(); // First: JsonSerializable? if (JsonSerializable.class.isAssignableFrom(raw)) { return SerializableSerializer.instance; } // Second: @JsonValue for any type AnnotatedMethod valueMethod = beanDesc.findJsonValueMethod(); if (valueMethod != null) { Method m = valueMethod.getAnnotated(); if (prov.canOverrideAccessModifiers()) { ClassUtil.checkAndFixAccess(m, prov.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } JsonSerializer<Object> ser = findSerializerFromAnnotation(prov, valueMethod); return new JsonValueSerializer(m, ser); } // No well-known annotations... return null; } /** * Method for checking if we can determine serializer to use based on set of * known primary types, checking for set of known base types (exact matches * having been compared against with <code>findSerializerByLookup</code>). * This does not include "secondary" interfaces, but * mostly concrete or abstract base classes. */ protected final JsonSerializer<?> findSerializerByPrimaryType(SerializerProvider prov, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException { Class<?> raw = type.getRawClass(); // Then check for optional/external serializers JsonSerializer<?> ser = findOptionalStdSerializer(prov, type, beanDesc, staticTyping); if (ser != null) { return ser; } if (Calendar.class.isAssignableFrom(raw)) { return CalendarSerializer.instance; } if (java.util.Date.class.isAssignableFrom(raw)) { return DateSerializer.instance; } if (Map.Entry.class.isAssignableFrom(raw)) { // 18-Oct-2015, tatu: With 2.7, need to dig type info

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>)) { throw new IllegalStateException("AnnotationIntrospector."+methodName+"() returned value of type "+src.getClass().getName()+": expected type JsonSerializer or Class<JsonSerializer> instead"); } Class<?> cls = (Class<?>) src; if (cls == noneClass || ClassUtil.isBogusClass(cls)) { return null; } return cls; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> @Override public SerializationConfig with(HandlerInstantiator hi) { return _withBase(_base.withHandlerInstantiator(hi)); } @Override public SerializationConfig with(PropertyNamingStrategy pns) { return _withBase(_base.withPropertyNamingStrategy(pns)); } @Override public SerializationConfig withRootName(PropertyName rootName) { if (rootName == null) { if (_rootName == null) { return this; } } else if (rootName.equals(_rootName)) { return this; } return new SerializationConfig(this, rootName); } @Override public SerializationConfig with(SubtypeResolver str) { return (str == _subtypeResolver)? this : new SerializationConfig(this, str); } @Override public SerializationConfig with(TypeFactory tf) { return _withBase(_base.withTypeFactory(tf)); } @Override public SerializationConfig with(TypeResolverBuilder<?> trb) { return _withBase(_base.withTypeResolverBuilder(trb)); } @Override public SerializationConfig withView(Class<?> view) { return (_view == view) ? this : new SerializationConfig(this, view); } @Override public SerializationConfig with(VisibilityChecker<?> vc) { return _withBase(_base.withVisibilityChecker(vc)); } @Override public SerializationConfig withVisibility(PropertyAccessor forMethod, JsonAutoDetect.Visibility visibility) { return _withBase(_base.withVisibility(forMethod, visibility)); } @Override public SerializationConfig with(Locale l) { return _withBase(_base.with(l)); } @Override public SerializationConfig with(TimeZone tz) { return _withBase(_base.with(tz)); } @Override public SerializationConfig with(Base64Variant base64) { return _withBase(_base.with(base64)); } @Override public SerializationConfig with(ContextAttributes attrs) { return (attrs == _attributes) ? this : new SerializationConfig(this, attrs); } private final SerializationConfig _withBase(BaseSettings newBase) { return (_base == newBase) ? this : new SerializationConfig(this, newBase); } /* /********************************************************** /* Factory methods for SerializationFeature /********************************************************** */ /** * Fluent factory method that will construct and return a new configuration * object instance with specified feature enabled. */ public SerializationConfig with(SerializationFeature feature) { int newSerFeatures = _serFeatures | feature.getMask(); return (newSerFeatures == _serFeatures) ? this : new SerializationConfig(this, _mapperFeatures, newSerFeatures, _generatorFeatures, _generatorFeaturesToChange, _formatWriteFeatures, _formatWriteFeaturesToChange); } /** * Fluent factory method that will construct and return a new

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>filterProvider) ? this : new SerializationConfig(this, filterProvider); } /** * @deprecated Since 2.7 use {@link #withPropertyInclusion} instead */ @Deprecated public SerializationConfig withSerializationInclusion(JsonInclude.Include incl) { return withPropertyInclusion(DEFAULT_INCLUSION.withValueInclusion(incl)); } /** * @since 2.7 */ public SerializationConfig withPropertyInclusion(JsonInclude.Value incl) { if (_serializationInclusion.equals(incl)) { return this; } return new SerializationConfig(this, incl); } /** * @since 2.6 */ public SerializationConfig withDefaultPrettyPrinter(PrettyPrinter pp) { return (_defaultPrettyPrinter == pp) ? this: new SerializationConfig(this, pp); } /* /********************************************************** /* Factories for objects configured here /********************************************************** */ public PrettyPrinter constructDefaultPrettyPrinter() { PrettyPrinter pp = _defaultPrettyPrinter; if (pp instanceof Instantiatable<?>) { pp = (PrettyPrinter) ((Instantiatable<?>) pp).createInstance(); } return pp; } /* /********************************************************** /* JsonParser initialization /********************************************************** */ /** * Method called by {@link ObjectMapper} and {@link ObjectWriter} * to modify those {@link com.fasterxml.jackson.core.JsonGenerator.Feature} settings * that have been configured via this config instance. * * @since 2.5 */ public void initialize(JsonGenerator g) { if (SerializationFeature.INDENT_OUTPUT.enabledIn(_serFeatures)) { // but do not override an explicitly set one if (g.getPrettyPrinter() == null) { PrettyPrinter pp = constructDefaultPrettyPrinter(); if (pp != null) { g.setPrettyPrinter(pp); } } } @SuppressWarnings("deprecation") boolean useBigDec = SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN.enabledIn(_serFeatures); int mask = _generatorFeaturesToChange; if ((mask != 0) || useBigDec) { int newFlags = _generatorFeatures; // although deprecated, needs to be supported for now if (useBigDec) { int f = JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN.getMask(); newFlags |= f; mask |= f; } g.overrideStdFeatures(newFlags, mask); } if (_formatWriteFeaturesToChange != 0) { g.overrideFormatFeatures(_formatWriteFeatures, _formatWriteFeaturesToChange); } } /* /********************************************************** /* MapperConfig implementation/overrides: introspection /********************************************************** */ @Override public AnnotationIntrospector getAnnotationIntrospector() { if (isEnabled(MapperFeature.USE_ANNOTATIONS)) { return super.getAnnotationIntrospector(); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> loc) { _timezone = tz; _locale = loc; } protected StdDateFormat(TimeZone tz, Locale loc, Boolean lenient) { _timezone = tz; _locale = loc; _lenient = lenient; } public static TimeZone getDefaultTimeZone() { return DEFAULT_TIMEZONE; } /** * Method used for creating a new instance with specified timezone; * if no timezone specified, defaults to the default timezone (UTC). */ public StdDateFormat withTimeZone(TimeZone tz) { if (tz == null) { tz = DEFAULT_TIMEZONE; } if ((tz == _timezone) || tz.equals(_timezone)) { return this; } return new StdDateFormat(tz, _locale, _lenient); } public StdDateFormat withLocale(Locale loc) { if (loc.equals(_locale)) { return this; } return new StdDateFormat(_timezone, loc, _lenient); } @Override public StdDateFormat clone() { /* Although there is that much state to share, we do need to * orchestrate a bit, mostly since timezones may be changed */ return new StdDateFormat(_timezone, _locale, _lenient); } /** * @deprecated Since 2.4; use variant that takes Locale */ @Deprecated public static DateFormat getISO8601Format(TimeZone tz) { return getISO8601Format(tz, DEFAULT_LOCALE); } /** * Method for getting a non-shared DateFormat instance * that uses specified timezone and can handle simple ISO-8601 * compliant date format. * * @since 2.4 */ public static DateFormat getISO8601Format(TimeZone tz, Locale loc) { return _cloneFormat(DATE_FORMAT_ISO8601, DATE_FORMAT_STR_ISO8601, tz, loc, null); } /** * Method for getting a non-shared DateFormat instance * that uses specific timezone and can handle RFC-1123 * compliant date format. * * @since 2.4 */ public static DateFormat getRFC1123Format(TimeZone tz, Locale loc) { return _cloneFormat(DATE_FORMAT_RFC1123, DATE_FORMAT_STR_RFC1123, tz, loc, null); } /** * @deprecated Since 2.4; use variant that takes Locale */ @Deprecated public static DateFormat getRFC1123Format(TimeZone tz) { return getRFC1123Format(tz, DEFAULT_LOCALE); } /* /********************************************************** /* Public API, configuration /********************************************************** */ @Override // since 2.6 public TimeZone getTimeZone() { return _timezone; } @Override public void

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> setTimeZone(TimeZone tz) { /* DateFormats are timezone-specific (via Calendar contained), * so need to reset instances if timezone changes: */ if (!tz.equals(_timezone)) { _clearFormats(); _timezone = tz; } } /** * Need to override since we need to keep track of leniency locally, * and not via underlying {@link Calendar} instance like base class * does. */ @Override // since 2.7 public void setLenient(boolean enabled) { Boolean newValue = enabled; if (_lenient != newValue) { _lenient = newValue; // and since leniency settings may have been used: _clearFormats(); } } @Override // since 2.7 public boolean isLenient() { if (_lenient == null) { // default is, I believe, true return true; } return _lenient.booleanValue(); } /* /********************************************************** /* Public API, parsing /********************************************************** */ @Override public Date parse(String dateStr) throws ParseException { dateStr = dateStr.trim(); ParsePosition pos = new ParsePosition(0); Date dt; if (looksLikeISO8601(dateStr)) { // also includes "plain" dt = parseAsISO8601(dateStr, pos, true); } else { // Also consider "stringified" simple time stamp int i = dateStr.length(); while (--i >= 0) { char ch = dateStr.charAt(i); if (ch < '0' || ch > '9') { // 07-Aug-2013, tatu: And [databind#267] points out that negative numbers should also work if (i > 0 || ch != '-') { break; } } } if ((i < 0) // let's just assume negative numbers are fine (can't be RFC-1123 anyway); check length for positive && (dateStr.charAt(0) == '-' || NumberInput.inLongRange(dateStr, false))) { dt = new Date(Long.parseLong(dateStr)); } else { // Otherwise, fall back to using RFC 1123 dt = parseAsRFC1123(dateStr, pos); } } if (dt != null) { return dt; } StringBuilder sb = new StringBuilder(); for (String f : ALL_FORMATS) { if (sb.length() > 0) { sb.append("\", \""); } else { sb.append('"'); } sb.append(f); } sb.append('"'); throw new ParseException (String.format("Can not parse date \"%s\": not compatible with any of standard forms (%s)", dateStr

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>, sb.toString()), pos.getErrorIndex()); } @Override public Date parse(String dateStr, ParsePosition pos) { if (looksLikeISO8601(dateStr)) { // also includes "plain" try { return parseAsISO8601(dateStr, pos, false); } catch (ParseException e) { // will NOT be thrown due to false but is declared... return null; } } // Also consider "stringified" simple time stamp int i = dateStr.length(); while (--i >= 0) { char ch = dateStr.charAt(i); if (ch < '0' || ch > '9') { // 07-Aug-2013, tatu: And [databind#267] points out that negative numbers should also work if (i > 0 || ch != '-') { break; } } } if (i < 0) { // all digits // let's just assume negative numbers are fine (can't be RFC-1123 anyway); check length for positive if (dateStr.charAt(0) == '-' || NumberInput.inLongRange(dateStr, false)) { return new Date(Long.parseLong(dateStr)); } } // Otherwise, fall back to using RFC 1123 return parseAsRFC1123(dateStr, pos); } /* /********************************************************** /* Public API, writing /********************************************************** */ @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { if (_formatISO8601 == null) { _formatISO8601 = _cloneFormat(DATE_FORMAT_ISO8601, DATE_FORMAT_STR_ISO8601, _timezone, _locale, _lenient); } return _formatISO8601.format(date, toAppendTo, fieldPosition); } /* /********************************************************** /* Std overrides /********************************************************** */ @Override public String toString() { String str = "DateFormat "+getClass().getName(); TimeZone tz = _timezone; if (tz != null) { str += " (timezone: "+tz+")"; } str += "(locale: "+_locale+")"; return str; } @Override // since 2.7[.2], as per [databind#1130] public boolean equals(Object o) { return (o == this); } @Override // since 2.7[.2], as per [databind#1130] public int hashCode() { return System.identityHashCode(this); } /* /********************************************************** /* Helper methods /********************************************************** */ /** * Overridable helper method used to figure out which of supported * formats is the

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> seems to fit format '%s', parsing fails (leniency? %s)", dateStr, formatStr, _lenient), pos.getErrorIndex()); } return dt; } protected Date parseAsRFC1123(String dateStr, ParsePosition pos) { if (_formatRFC1123 == null) { _formatRFC1123 = _cloneFormat(DATE_FORMAT_RFC1123, DATE_FORMAT_STR_RFC1123, _timezone, _locale, _lenient); } return _formatRFC1123.parse(dateStr, pos); } private final static boolean hasTimeZone(String str) { // Only accept "+hh", "+hhmm" and "+hh:mm" (and with minus), so int len = str.length(); if (len >= 6) { char c = str.charAt(len-6); if (c == '+' || c == '-') return true; c = str.charAt(len-5); if (c == '+' || c == '-') return true; c = str.charAt(len-3); if (c == '+' || c == '-') return true; } return false; } private final static DateFormat _cloneFormat(DateFormat df, String format, TimeZone tz, Locale loc, Boolean lenient) { if (!loc.equals(DEFAULT_LOCALE)) { df = new SimpleDateFormat(format, loc); df.setTimeZone((tz == null) ? DEFAULT_TIMEZONE : tz); } else { df = (DateFormat) df.clone(); if (tz != null) { df.setTimeZone(tz); } } if (lenient != null) { df.setLenient(lenient.booleanValue()); } return df; } protected void _clearFormats() { _formatRFC1123 = null; _formatISO8601 = null; _formatISO8601_z = null; _formatPlain = null; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> public void addIntCreator(AnnotatedWithParams creator, boolean explicit) { verifyNonDup(creator, C_INT, explicit); } public void addLongCreator(AnnotatedWithParams creator, boolean explicit) { verifyNonDup(creator, C_LONG, explicit); } public void addDoubleCreator(AnnotatedWithParams creator, boolean explicit) { verifyNonDup(creator, C_DOUBLE, explicit); } public void addBooleanCreator(AnnotatedWithParams creator, boolean explicit) { verifyNonDup(creator, C_BOOLEAN, explicit); } public void addDelegatingCreator(AnnotatedWithParams creator, boolean explicit, SettableBeanProperty[] injectables) { if (creator.getParameterType(0).isCollectionLikeType()) { verifyNonDup(creator, C_ARRAY_DELEGATE, explicit); _arrayDelegateArgs = injectables; } else { verifyNonDup(creator, C_DELEGATE, explicit); _delegateArgs = injectables; } } public void addPropertyCreator(AnnotatedWithParams creator, boolean explicit, SettableBeanProperty[] properties) { verifyNonDup(creator, C_PROPS, explicit); // Better ensure we have no duplicate names either... if (properties.length > 1) { HashMap<String,Integer> names = new HashMap<String,Integer>(); for (int i = 0, len = properties.length; i < len; ++i) { String name = properties[i].getName(); /* [Issue-13]: Need to consider Injectables, which may not have * a name at all, and need to be skipped */ if (name.length() == 0 && properties[i].getInjectableValueId() != null) { continue; } Integer old = names.put(name, Integer.valueOf(i)); if (old != null) { throw new IllegalArgumentException("Duplicate creator property \""+name+"\" (index "+old+" vs "+i+")"); } } } _propertyBasedArgs = properties; } public void addIncompeteParameter(AnnotatedParameter parameter) { if (_incompleteParameter == null) { _incompleteParameter = parameter; } } // Bunch of methods deprecated in 2.5, to be removed from 2.6 or later @Deprecated // since 2.5 public void addStringCreator(AnnotatedWithParams creator) { addStringCreator(creator, false); } @Deprecated // since 2.5 public void addIntCreator(AnnotatedWithParams creator) { addBooleanCreator(creator, false); } @Deprecated // since 2.5 public void addLongCreator(AnnotatedWithParams creator) { addBooleanCreator(creator, false); } @Deprecated // since 2.5 public void addDoubleCreator(AnnotatedWithParams creator) { addBooleanCreator(creator, false);

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>7]: avoid one particular class of bogus problems Class<?> oldType = oldOne.getRawParameterType(0); Class<?> newType = newOne.getRawParameterType(0); if (oldType == newType) { throw new IllegalArgumentException("Conflicting "+TYPE_DESCS[typeIndex] +" creators: already had explicitly marked "+oldOne+", encountered "+newOne); } // otherwise, which one to choose? if (newType.isAssignableFrom(oldType)) { // new type more generic, use old return; } // new type more specific, use it } } if (explicit) { _explicitCreators |= mask; } _creators[typeIndex] = _fixAccess(newOne); } /* /********************************************************** /* Helper class(es) /********************************************************** */ protected final static class Vanilla extends ValueInstantiator implements java.io.Serializable { private static final long serialVersionUID = 1L; public final static int TYPE_COLLECTION = 1; public final static int TYPE_MAP = 2; public final static int TYPE_HASH_MAP = 3; private final int _type; public Vanilla(int t) { _type = t; } @Override public String getValueTypeDesc() { switch (_type) { case TYPE_COLLECTION: return ArrayList.class.getName(); case TYPE_MAP: return LinkedHashMap.class.getName(); case TYPE_HASH_MAP: return HashMap.class.getName(); } return Object.class.getName(); } @Override public boolean canInstantiate() { return true; } @Override public boolean canCreateUsingDefault() { return true; } @Override public Object createUsingDefault(DeserializationContext ctxt) throws IOException { switch (_type) { case TYPE_COLLECTION: return new ArrayList<Object>(); case TYPE_MAP: return new LinkedHashMap<String,Object>(); case TYPE_HASH_MAP: return new HashMap<String,Object>(); } throw new IllegalStateException("Unknown type "+_type); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind; import com.fasterxml.jackson.core.SerializableString; import com.fasterxml.jackson.core.io.SerializedString; import com.fasterxml.jackson.core.util.InternCache; import com.fasterxml.jackson.databind.cfg.MapperConfig; /** * Simple value class used for containing names of properties as defined * by annotations (and possibly other configuration sources). * * @since 2.1 */ public class PropertyName implements java.io.Serializable { private static final long serialVersionUID = 1L; // 2.5 private final static String _USE_DEFAULT = ""; private final static String _NO_NAME = ""; /** * Special placeholder value that indicates that name to use should be * based on the standard heuristics. This can be different from returning * null, as null means "no information available, whereas this value * indicates explicit defaulting. */ public final static PropertyName USE_DEFAULT = new PropertyName(_USE_DEFAULT, null); /** * Special placeholder value that indicates that there is no name associated. * Exact semantics to use (if any) depend on actual annotation in use, but * commonly this value disables behavior for which name would be needed. */ public final static PropertyName NO_NAME = new PropertyName(new String(_NO_NAME), null); /** * Basic name of the property. */ protected final String _simpleName; /** * Additional namespace, for formats that have such concept (JSON * does not, XML does, for example). */ protected final String _namespace; /** * Lazily-constructed efficient representation of the simple name. *<p> * NOTE: not defined as volatile to avoid performance problem with * concurrent access in multi-core environments; due to statelessness * of {@link SerializedString} at most leads to multiple instantiations. * * @since 2.4 */ protected SerializableString _encodedSimple; public PropertyName(String simpleName) { this(simpleName, null); } public PropertyName(String simpleName, String namespace) { _simpleName = (simpleName == null) ? "" : simpleName; _namespace = namespace; } // To support JDK serialization, recovery of Singleton instance protected Object readResolve() { if (_simpleName == null || _USE_DEFAULT.equals(_simpleName)) { return USE_DEFAULT; } if (_simpleName.equals(_NO_NAME) && _namespace == null) { return NO_NAME; } return this; } /** * @since 2.6 */ public static PropertyName construct(String simpleName) { if (simpleName == null || simpleName.length() == 0) { return USE_DEFAULT; } return new PropertyName(InternCache.instance.intern

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(simpleName), null); } public static PropertyName construct(String simpleName, String ns) { if (simpleName == null) { simpleName = ""; } if (ns == null && simpleName.length() == 0) { return USE_DEFAULT; } return new PropertyName(InternCache.instance.intern(simpleName), ns); } public PropertyName internSimpleName() { if (_simpleName.length() == 0) { // empty String is canonical already return this; } String interned = InternCache.instance.intern(_simpleName); if (interned == _simpleName) { // was already interned return this; } return new PropertyName(interned, _namespace); } /** * Fluent factory method for constructing an instance with different * simple name. */ public PropertyName withSimpleName(String simpleName) { if (simpleName == null) { simpleName = ""; } if (simpleName.equals(_simpleName)) { return this; } return new PropertyName(simpleName, _namespace); } /** * Fluent factory method for constructing an instance with different * namespace. */ public PropertyName withNamespace(String ns) { if (ns == null) { if (_namespace == null) { return this; } } else if (ns.equals(_namespace)) { return this; } return new PropertyName(_simpleName, ns); } /* /********************************************************** /* Accessors /********************************************************** */ public String getSimpleName() { return _simpleName; } /** * Accessor that may be used to get lazily-constructed efficient * representation of the simple name. * * @since 2.4 */ public SerializableString simpleAsEncoded(MapperConfig<?> config) { SerializableString sstr = _encodedSimple; if (sstr == null) { if (config == null) { sstr = new SerializedString(_simpleName); } else { sstr = config.compileString(_simpleName); } _encodedSimple = sstr; } return sstr; } public String getNamespace() { return _namespace; } public boolean hasSimpleName() { return _simpleName.length() > 0; } /** * @since 2.3 */ public boolean hasSimpleName(String str) { if (str == null) { return _simpleName == null; } return str.equals(_simpleName); } public boolean hasNamespace() { return _namespace != null; } /** * Method that is basically equivalent of: *<pre> * !hasSimpleName() &lt;&lt; !hasNamespace(); *</pre> * * @since 2.4

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> */ public boolean isEmpty() { return (_namespace == null) && (_simpleName.isEmpty()); } /* /********************************************************** /* Std method overrides /********************************************************** */ @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; /* 13-Nov-2012, tatu: by default, require strict type equality. * Re-evaluate if this becomes an issue. */ if (o.getClass() != getClass()) return false; // 13-Nov-2012, tatu: Should we have specific rules on matching USE_DEFAULT? // (like, it only ever matching exact instance) // If we did, would need to check symmetrically; that is, if either 'this' // or 'o' was USE_DEFAULT, both would have to be. PropertyName other = (PropertyName) o; if (_simpleName == null) { if (other._simpleName != null) return false; } else if (!_simpleName.equals(other._simpleName)) { return false; } if (_namespace == null) { return (null == other._namespace); } return _namespace.equals(other._namespace); } @Override public int hashCode() { if (_namespace == null) { return _simpleName.hashCode(); } return _namespace.hashCode() ^ _simpleName.hashCode(); } @Override public String toString() { if (_namespace == null) { return _simpleName; } return "{"+_namespace + "}" + _simpleName; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>); } } } } // And after handlers, possible type refinements // (note: could possibly avoid this if explicit deserializer was invoked?) type = intr.refineDeserializationType(ctxt.getConfig(), a, type); return type; } /* /********************************************************** /* Helper methods, other /********************************************************** */ /** * Helper method used to prevent both caching and cache lookups for structured * types that have custom value handlers * * @since 2.4.6 */ private boolean _hasCustomValueHandler(JavaType t) { if (t.isContainerType()) { JavaType ct = t.getContentType(); if (ct != null) { return (ct.getValueHandler() != null) || (ct.getTypeHandler() != null); } } return false; } private Class<?> _verifyAsClass(Object src, String methodName, Class<?> noneClass) { if (src == null) { return null; } if (!(src instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector."+methodName+"() returned value of type "+src.getClass().getName()+": expected type JsonSerializer or Class<JsonSerializer> instead"); } Class<?> cls = (Class<?>) src; if (cls == noneClass || ClassUtil.isBogusClass(cls)) { return null; } return cls; } /* /********************************************************** /* Overridable error reporting methods /********************************************************** */ // NOTE: changed 2.6 -> 2.7 to pass context; no way to make backwards compatible protected JsonDeserializer<Object> _handleUnknownValueDeserializer(DeserializationContext ctxt, JavaType type) throws JsonMappingException { /* Let's try to figure out the reason, to give better error * messages */ Class<?> rawClass = type.getRawClass(); if (!ClassUtil.isConcrete(rawClass)) { throw JsonMappingException.from(ctxt, "Can not find a Value deserializer for abstract type "+type); } throw JsonMappingException.from(ctxt, "Can not find a Value deserializer for type "+type); } protected KeyDeserializer _handleUnknownKeyDeserializer(DeserializationContext ctxt, JavaType type) throws JsonMappingException { throw JsonMappingException.from(ctxt, "Can not find a (Map) Key deserializer for type "+type); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.util.Arrays; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * Value node that contains Base64 encoded binary value, which will be * output and stored as Json String value. */ public class BinaryNode extends ValueNode { final static BinaryNode EMPTY_BINARY_NODE = new BinaryNode(new byte[0]); protected final byte[] _data; public BinaryNode(byte[] data) { _data = data; } public BinaryNode(byte[] data, int offset, int length) { if (offset == 0 && length == data.length) { _data = data; } else { _data = new byte[length]; System.arraycopy(data, offset, _data, 0, length); } } public static BinaryNode valueOf(byte[] data) { if (data == null) { return null; } if (data.length == 0) { return EMPTY_BINARY_NODE; } return new BinaryNode(data); } public static BinaryNode valueOf(byte[] data, int offset, int length) { if (data == null) { return null; } if (length == 0) { return EMPTY_BINARY_NODE; } return new BinaryNode(data, offset, length); } @Override public JsonNodeType getNodeType() { return JsonNodeType.BINARY; } @Override public JsonToken asToken() { /* No distinct type; could use one for textual values, * but given that it's not in text form at this point, * embedded-object is closest */ return JsonToken.VALUE_EMBEDDED_OBJECT; } /** *<p> * Note: caller is not to modify returned array in any way, since * it is not a copy but reference to the underlying byte array. */ @Override public byte[] binaryValue() { return _data; } /** * Hmmh. This is not quite as efficient as using {@link #serialize}, * but will work correctly. */ @Override public String asText() { return Base64Variants.getDefaultVariant().encode(_data, false); } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeBinary(provider.getConfig().getBase64Variant(), _data, 0, _data.length); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (!(o instanceof BinaryNode)) { return false; } return Arrays.equals(((Binary

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> return new PropertyMetadata(_required, desc, _index, _defaultValue); } public PropertyMetadata withDefaultValue(String def) { if ((def == null) || def.isEmpty()) { if (_defaultValue == null) { return this; } def = null; } else if (_defaultValue.equals(def)) { return this; } return new PropertyMetadata(_required, _description, _index, def); } public PropertyMetadata withIndex(Integer index) { return new PropertyMetadata(_required, _description, index, _defaultValue); } public PropertyMetadata withRequired(Boolean b) { if (b == null) { if (_required == null) { return this; } } else { if (_required != null && _required.booleanValue() == b.booleanValue()) { return this; } } return new PropertyMetadata(b, _description, _index, _defaultValue); } /* /********************************************************** /* Accessors /********************************************************** */ public String getDescription() { return _description; } /** * @since 2.5 */ public String getDefaultValue() { return _defaultValue; } /** * @deprecated Since 2.6: typo in name, use {@link #hasDefaultValue()} instead. */ @Deprecated public boolean hasDefuaultValue() { return hasDefaultValue(); } /** * Accessor for determining whether property has declared "default value", * which may be used by extension modules. * * @since 2.6 */ public boolean hasDefaultValue() { return (_defaultValue != null); } public boolean isRequired() { return (_required != null) && _required.booleanValue(); } public Boolean getRequired() { return _required; } /** * @since 2.4 */ public Integer getIndex() { return _index; } /** * @since 2.4 */ public boolean hasIndex() { return _index != null; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Sub-class "+getClass().getName()+" must override 'withDelegate'"); } return new StdDelegatingSerializer(converter, delegateType, delegateSerializer); } /* /********************************************************** /* Contextualization /********************************************************** */ @Override public void resolve(SerializerProvider provider) throws JsonMappingException { if ((_delegateSerializer != null) && (_delegateSerializer instanceof ResolvableSerializer)) { ((ResolvableSerializer) _delegateSerializer).resolve(provider); } } @Override public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JsonSerializer<?> delSer = _delegateSerializer; JavaType delegateType = _delegateType; if (delSer == null) { // Otherwise, need to locate serializer to delegate to. For that we need type information... if (delegateType == null) { delegateType = _converter.getOutputType(provider.getTypeFactory()); } /* 02-Apr-2015, tatu: For "dynamic case", where type is only specified as * java.lang.Object (or missing generic), [databind#731] */ if (!delegateType.isJavaLangObject()) { delSer = provider.findValueSerializer(delegateType); } } if (delSer instanceof ContextualSerializer) { delSer = provider.handleSecondaryContextualization(delSer, property); } if (delSer == _delegateSerializer && delegateType == _delegateType) { return this; } return withDelegate(_converter, delegateType, delSer); } /* /********************************************************** /* Accessors /********************************************************** */ protected Converter<Object, ?> getConverter() { return _converter; } @Override public JsonSerializer<?> getDelegatee() { return _delegateSerializer; } /* /********************************************************** /* Serialization /********************************************************** */ @Override public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException { Object delegateValue = convertValue(value); // should we accept nulls? if (delegateValue == null) { provider.defaultSerializeNull(gen); return; } // 02-Apr-2015, tatu: As per [databind#731] may need to do dynamic lookup JsonSerializer<Object> ser = _delegateSerializer; if (ser == null) { ser = _findSerializer(delegateValue, provider); } ser.serialize(delegateValue, gen, provider); } @Override public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer) throws IOException { /* 03-Oct-2012, tatu: This is actually unlikely to work ok... but for now, * let's give it a chance? */ Object delegateValue = convertValue(value); JsonSerializer<

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.util.ClassUtil; /** * Object that represents non-static (and usually non-transient/volatile) * fields of a class. */ public final class AnnotatedField extends AnnotatedMember implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Actual {@link Field} used for access. *<p> * Transient since it can not be persisted directly using * JDK serialization */ protected final transient Field _field; /** * Temporary field required for JDK serialization support */ protected Serialization _serialization; /* /********************************************************** /* Life-cycle /********************************************************** */ public AnnotatedField(TypeResolutionContext contextClass, Field field, AnnotationMap annMap) { super(contextClass, annMap); _field = field; } @Override public AnnotatedField withAnnotations(AnnotationMap ann) { return new AnnotatedField(_typeContext, _field, ann); } /** * Method used for JDK serialization support */ protected AnnotatedField(Serialization ser) { super(null, null); _field = null; _serialization = ser; } /* /********************************************************** /* Annotated impl /********************************************************** */ @Override public Field getAnnotated() { return _field; } @Override public int getModifiers() { return _field.getModifiers(); } @Override public String getName() { return _field.getName(); } @Override public Class<?> getRawType() { return _field.getType(); } @Deprecated @Override public Type getGenericType() { return _field.getGenericType(); } @Override public JavaType getType() { return _typeContext.resolveType(_field.getGenericType()); } /* /********************************************************** /* AnnotatedMember impl /********************************************************** */ @Override public Class<?> getDeclaringClass() { return _field.getDeclaringClass(); } @Override public Member getMember() { return _field; } @Override public void setValue(Object pojo, Object value) throws IllegalArgumentException { try { _field.set(pojo, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to setValue() for field " +getFullName()+": "+e.getMessage(), e); } } @Override public Object getValue(Object pojo) throws IllegalArgumentException { try { return _field.get(pojo); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to getValue() for field " +getFullName()+": "+e.getMessage(), e); } } /* /********************************************************** /* Extended API, generic /

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>********************************************************** */ public String getFullName() { return getDeclaringClass().getName() + "#" + getName(); } public int getAnnotationCount() { return _annotations.size(); } /** * @since 2.6 */ public boolean isTransient() { return Modifier.isTransient(getModifiers()); } @Override public int hashCode() { return _field.getName().hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; return ((AnnotatedField) o)._field == _field; } @Override public String toString() { return "[field "+getFullName()+"]"; } /* /********************************************************** /* JDK serialization handling /********************************************************** */ Object writeReplace() { return new AnnotatedField(new Serialization(_field)); } Object readResolve() { Class<?> clazz = _serialization.clazz; try { Field f = clazz.getDeclaredField(_serialization.name); // 06-Oct-2012, tatu: Has "lost" its security override, may need to force back if (!f.isAccessible()) { ClassUtil.checkAndFixAccess(f, false); } return new AnnotatedField(null, f, null); } catch (Exception e) { throw new IllegalArgumentException("Could not find method '"+_serialization.name +"' from Class '"+clazz.getName()); } } /** * Helper class that is used as the workaround to persist * Field references. It basically just stores declaring class * and field name. */ private final static class Serialization implements java.io.Serializable { private static final long serialVersionUID = 1L; protected Class<?> clazz; protected String name; public Serialization(Field f) { clazz = f.getDeclaringClass(); name = f.getName(); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * * @since 2.3 */ protected final Object _filterId; /** * Flag set if output is forced to be sorted by keys (usually due * to annotation). * * @since 2.4 */ protected final boolean _sortKeys; /** * Value that indicates suppression mechanism to use for <b>values contained</b>; * either one of values of {@link com.fasterxml.jackson.annotation.JsonInclude.Include}, * or actual object to compare against ("default value"). * Note that inclusion value for Map instance itself is handled by caller (POJO * property that refers to the Map value). * * @since 2.5 */ protected final Object _suppressableValue; /* /********************************************************** /* Life-cycle /********************************************************** */ /** * @since 2.5 */ @SuppressWarnings("unchecked") protected MapSerializer(HashSet<String> ignoredEntries, JavaType keyType, JavaType valueType, boolean valueTypeIsStatic, TypeSerializer vts, JsonSerializer<?> keySerializer, JsonSerializer<?> valueSerializer) { super(Map.class, false); _ignoredEntries = ignoredEntries; _keyType = keyType; _valueType = valueType; _valueTypeIsStatic = valueTypeIsStatic; _valueTypeSerializer = vts; _keySerializer = (JsonSerializer<Object>) keySerializer; _valueSerializer = (JsonSerializer<Object>) valueSerializer; _dynamicValueSerializers = PropertySerializerMap.emptyForProperties(); _property = null; _filterId = null; _sortKeys = false; _suppressableValue = null; } /** * @since 2.5 */ protected void _ensureOverride() { if (getClass() != MapSerializer.class) { throw new IllegalStateException("Missing override in class "+getClass().getName()); } } @SuppressWarnings("unchecked") protected MapSerializer(MapSerializer src, BeanProperty property, JsonSerializer<?> keySerializer, JsonSerializer<?> valueSerializer, HashSet<String> ignored) { super(Map.class, false); _ignoredEntries = ignored; _keyType = src._keyType; _valueType = src._valueType; _valueTypeIsStatic = src._valueTypeIsStatic; _valueTypeSerializer = src._valueTypeSerializer; _keySerializer = (JsonSerializer<Object>) keySerializer; _valueSerializer = (JsonSerializer<Object>) valueSerializer; _dynamicValueSerializers = src._dynamicValueSerializers; _property = property; _filterId = src._filterId; _sortKeys = src._sortKeys; _suppressableValue = src._suppressableValue; } @Deprecated // since 2.5 protected MapSerializer(MapSerializer src, TypeSerializer vts) { this(src, vts, src._suppressableValue); } /** * @since

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * Exact structured type deserializer handles, if known. *<p> * Default implementation just returns null. */ public JavaType getValueType() { return null; } /** * Method that can be called to determine if given deserializer is the default * deserializer Jackson uses; as opposed to a custom deserializer installed by * a module or calling application. Determination is done using * {@link JacksonStdImpl} annotation on deserializer class. */ protected boolean isDefaultDeserializer(JsonDeserializer<?> deserializer) { return ClassUtil.isJacksonStdImpl(deserializer); } protected boolean isDefaultKeyDeserializer(KeyDeserializer keyDeser) { return ClassUtil.isJacksonStdImpl(keyDeser); } /* /********************************************************** /* Partial JsonDeserializer implementation /********************************************************** */ /** * Base implementation that does not assume specific type * inclusion mechanism. Sub-classes are expected to override * this method if they are to handle type information. */ @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { return typeDeserializer.deserializeTypedFromAny(jp, ctxt); } /* /********************************************************** /* Helper methods for sub-classes, parsing: while mostly /* useful for numeric types, can be also useful for dealing /* with things serialized as numbers (such as Dates). /********************************************************** */ protected final boolean _parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_TRUE) return true; if (t == JsonToken.VALUE_FALSE) return false; if (t == JsonToken.VALUE_NULL) return false; // [JACKSON-78]: should accept ints too, (0 == false, otherwise true) if (t == JsonToken.VALUE_NUMBER_INT) { // 11-Jan-2012, tatus: May be outside of int... if (jp.getNumberType() == NumberType.INT) { return (jp.getIntValue() != 0); } return _parseBooleanFromOther(jp, ctxt); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); // [#422]: Allow aliases if ("true".equals(text) || "True".equals(text)) { return true; } if ("false".equals(text) || "False".equals(text) || text.length() == 0) { return false; } if (_hasTextualNull(text)) { return false; } throw ctxt.weirdStringException(text, _valueClass, "only \"true\" or \"false\" recognized"); } // [databind#

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>381] if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final boolean parsed = _parseBooleanPrimitive(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'boolean' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_TRUE) { return Boolean.TRUE; } if (t == JsonToken.VALUE_FALSE) { return Boolean.FALSE; } // [JACKSON-78]: should accept ints too, (0 == false, otherwise true) if (t == JsonToken.VALUE_NUMBER_INT) { // 11-Jan-2012, tatus: May be outside of int... if (p.getNumberType() == NumberType.INT) { return (p.getIntValue() == 0) ? Boolean.FALSE : Boolean.TRUE; } return Boolean.valueOf(_parseBooleanFromOther(p, ctxt)); } if (t == JsonToken.VALUE_NULL) { return (Boolean) getNullValue(ctxt); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = p.getText().trim(); // [#422]: Allow aliases if ("true".equals(text) || "True".equals(text)) { return Boolean.TRUE; } if ("false".equals(text) || "False".equals(text)) { return Boolean.FALSE; } if (text.length() == 0) { return (Boolean) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Boolean) getNullValue(ctxt); } throw ctxt.weirdStringException(text, _valueClass, "only \"true\" or \"false\" recognized"); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Boolean parsed = _parseBoolean(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Boolean' value but there was more

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final boolean _parseBooleanFromOther(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.getNumberType() == NumberType.LONG) { return (p.getLongValue() == 0L) ? Boolean.FALSE : Boolean.TRUE; } // no really good logic; let's actually resort to textual comparison String str = p.getText(); if ("0.0".equals(str) || "0".equals(str)) { return Boolean.FALSE; } return Boolean.TRUE; } protected Byte _parseByte(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return p.getByteValue(); } if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse String text = p.getText().trim(); if (_hasTextualNull(text)) { return (Byte) getNullValue(ctxt); } int value; try { int len = text.length(); if (len == 0) { return (Byte) getEmptyValue(ctxt); } value = NumberInput.parseInt(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid Byte value"); } // So far so good: but does it fit? // as per [JACKSON-804], allow range up to 255, inclusive if (value < Byte.MIN_VALUE || value > 255) { throw ctxt.weirdStringException(text, _valueClass, "overflow, value can not be represented as 8-bit value"); } return Byte.valueOf((byte) value); } if (t == JsonToken.VALUE_NUMBER_FLOAT) { if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "Byte"); } return p.getByteValue(); } if (t == JsonToken.VALUE_NULL) { return (Byte) getNullValue(ctxt); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Byte parsed = _parseByte(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Byte' value but there was more

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>); } return ctxt.parseDate(value); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(value, _valueClass, "not a valid representation (error: "+iae.getMessage()+")"); } } // [databind#381] if (t == JsonToken.START_ARRAY) { if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Date parsed = _parseDate(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'java.util.Date' value but there was more than a single value in the array"); } return parsed; } } throw ctxt.mappingException(_valueClass, t); } /** * Helper method for encapsulating calls to low-level double value parsing; single place * just because we need a work-around that must be applied to all calls. */ protected final static double parseDouble(String numStr) throws NumberFormatException { // avoid some nasty float representations... but should it be MIN_NORMAL or MIN_VALUE? if (NumberInput.NASTY_SMALL_DOUBLE.equals(numStr)) { return Double.MIN_NORMAL; // since 2.7; was MIN_VALUE prior } return Double.parseDouble(numStr); } /** * Helper method used for accessing String value, if possible, doing * necessary conversion or throwing exception as necessary. * * @since 2.1 */ protected final String _parseString(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_STRING) { return p.getText(); } // [databind#381] if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final String parsed = _parseString(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'String' value but there was more than a single value in the array"); } return parsed; } String value = p.getValueAsString(); if (value != null) { return value; } throw ctxt.mappingException(String.class, p.getCurrentToken()); } /** * Helper method that may be used to support fallback for Empty String / Empty Array * non-standard representations; usually for things serialized as JSON Objects. * * @since 2.5 */ protected

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> T _deserializeFromEmpty(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.START_ARRAY) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { t = jp.nextToken(); if (t == JsonToken.END_ARRAY) { return null; } throw ctxt.mappingException(handledType(), JsonToken.START_ARRAY); } } else if (t == JsonToken.VALUE_STRING) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { String str = jp.getText().trim(); if (str.isEmpty()) { return null; } } } throw ctxt.mappingException(handledType()); } /** * Helper method called to determine if we are seeing String value of * "null", and, further, that it should be coerced to null just like * null token. * * @since 2.3 */ protected boolean _hasTextualNull(String value) { return "null".equals(value); } protected final boolean _isNegInf(String text) { return "-Infinity".equals(text) || "-INF".equals(text); } protected final boolean _isPosInf(String text) { return "Infinity".equals(text) || "INF".equals(text); } protected final boolean _isNaN(String text) { return "NaN".equals(text); } /* /**************************************************** /* Helper methods for sub-classes, coercions /**************************************************** */ /** * Helper method called in case where an integral number is encountered, but * config settings suggest that a coercion may be needed to "upgrade" * {@link java.lang.Number} into "bigger" type like {@link java.lang.Long} or * {@link java.math.BigInteger} * * @see DeserializationFeature#USE_BIG_INTEGER_FOR_INTS * @see DeserializationFeature#USE_LONG_FOR_INTS * * @since 2.6 */ protected Object _coerceIntegral(JsonParser p, DeserializationContext ctxt) throws IOException { int feats = ctxt.getDeserializationFeatures(); if (DeserializationFeature.USE_BIG_INTEGER_FOR_INTS.enabledIn(feats)) { return p.getBigIntegerValue(); } if (DeserializationFeature.USE_LONG_FOR_INTS.enabledIn(feats)) { return p.getLongValue(); } return p.getBigIntegerValue(); // should be optimal, whatever it is } /* /**************************************************** /* Helper methods for sub-classes, resolving dependencies /**************************************************** */ /** * Helper method used to locate deserializers for properties the * type this de

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>[1]); } TypeVariable<?>[] vars = erasedType.getTypeParameters(); String[] names; if (vars == null || vars.length == 0) { names = NO_STRINGS; } else { int len = vars.length; names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); } public static TypeBindings create(Class<?> erasedType, JavaType typeArg1) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor1(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 1) { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with 1 type parameter: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName() }, new JavaType[] { typeArg1 }, null); } public static TypeBindings create(Class<?> erasedType, JavaType typeArg1, JavaType typeArg2) { // 30-Oct-2015, tatu: Minor optimization for relatively common cases TypeVariable<?>[] vars = TypeParamStash.paramsFor2(erasedType); int varLen = (vars == null) ? 0 : vars.length; if (varLen != 2) { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with 2 type parameters: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName(), vars[1].getName() }, new JavaType[] { typeArg1, typeArg2 }, null); } /** * Alternate factory method that may be called if it is possible that type * does or does not require type parameters; this is mostly useful for * collection- and map-like types. */ public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType typeArg1) { TypeVariable<?>[] vars = erasedType.getTypeParameters(); int varLen = (vars == null) ? 0 : vars.length; if (varLen == 0) { return EMPTY; } if (varLen != 1)

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with 1 type parameter: class expects "+varLen); } return new TypeBindings(new String[] { vars[0].getName() }, new JavaType[] { typeArg1 }, null); } /** * Alternate factory method that may be called if it is possible that type * does or does not require type parameters; this is mostly useful for * collection- and map-like types. */ public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType[] types) { TypeVariable<?>[] vars = erasedType.getTypeParameters(); if (vars == null || vars.length == 0) { return EMPTY; } if (types == null) { types = NO_TYPES; } int len = vars.length; String[] names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); } /** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); } /* /********************************************************************** /* Accessors /********************************************************************** */ /** * Find type bound to specified name, if there is one; returns bound type if so, null if not. */ public JavaType findBoundType(String name) { for (int i = 0, len = _names.length; i < len; ++i) { if (name.equals(_names[i])) { JavaType t = _types[i]; if (t instanceof ResolvedRecursiveType) { ResolvedRecursiveType rrt = (ResolvedRecursiveType) t; JavaType t2 = rrt.getSelfReferencedType(); if (t2 != null) { t = t2; } else { /* 25-Feb-2016, tatu: Looks like a potential

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> problem, but alas * we have a test where this should NOT fail and things... seem * to work. So be it. */ /* throw new IllegalStateException(String.format ("Unresolved ResolvedRecursiveType for parameter '%s' (index #%d; erased type %s)", name, i, t.getRawClass())); */ } } return t; } } return null; } public boolean isEmpty() { return (_types.length == 0); } /** * Returns number of bindings contained */ public int size() { return _types.length; } public String getBoundName(int index) { if (index < 0 || index >= _names.length) { return null; } return _names[index]; } public JavaType getBoundType(int index) { if (index < 0 || index >= _types.length) { return null; } return _types[index]; } /** * Accessor for getting bound types in declaration order */ public List<JavaType> getTypeParameters() { if (_types.length == 0) { return Collections.emptyList(); } return Arrays.asList(_types); } /** * @since 2.3 */ public boolean hasUnbound(String name) { if (_unboundVariables != null) { for (int i = _unboundVariables.length; --i >= 0; ) { if (name.equals(_unboundVariables[i])) { return true; } } } return false; } /** * Factory method that will create an object that can be used as a key for * caching purposes by {@link TypeFactory} * * @since 2.8 */ public Object asKey(Class<?> rawBase) { // safe to pass _types array without copy since it is not exposed via // any access, nor modified by this class return new AsKey(rawBase, _types, _hashCode); } /* /********************************************************************** /* Standard methods /********************************************************************** */ @Override public String toString() { if (_types.length == 0) { return "<>"; } StringBuilder sb = new StringBuilder(); sb.append('<'); for (int i = 0, len = _types.length; i < len; ++i) { if (i > 0) { sb.append(','); } // sb = _types[i].appendBriefDescription(sb); String sig = _types[i].getGenericSignature(); sb.append(sig); } sb.append('>'); return sb.toString(); } @Override public int hashCode() { return _hashCode; } @Override public boolean equals(Object o) { if (o == this) return true;

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> if (o == null || o.getClass() != getClass()) return false; TypeBindings other = (TypeBindings) o; int len = _types.length; if (len != other.size()) { return false; } JavaType[] otherTypes = other._types; for (int i = 0; i < len; ++i) { if (!otherTypes[i].equals(_types[i])) { return false; } } return true; } /* /********************************************************************** /* Package accessible methods /********************************************************************** */ protected JavaType[] typeParameterArray() { return _types; } /* /********************************************************************** /* Helper classes /********************************************************************** */ // 30-Oct-2015, tatu: Surprising, but looks like type parameters access can be bit of // a hot spot. So avoid for a small number of common generic types. Note that we do // need both common abstract types and concrete ones; latter for specialization /** * Helper class that contains simple logic for avoiding repeated lookups via * {@link Class#getTypeParameters()} as that can be a performance issue for * some use cases (wasteful, usually one-off or not reusing mapper). * Partly isolated to avoid initialization for cases where no generic types are * used. */ static class TypeParamStash { private final static TypeVariable<?>[] VARS_ABSTRACT_LIST = AbstractList.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_COLLECTION = Collection.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_ITERABLE = Iterable.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_LIST = List.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_ARRAY_LIST = ArrayList.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_MAP = Map.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_HASH_MAP = HashMap.class.getTypeParameters(); private final static TypeVariable<?>[] VARS_LINKED_HASH_MAP = LinkedHashMap.class.getTypeParameters(); public static TypeVariable<?>[] paramsFor1(Class<?> erasedType) { if (erasedType == Collection.class) { return VARS_COLLECTION; } if (erasedType == List.class) { return VARS_LIST; } if (erasedType == ArrayList.class) { return VARS_ARRAY_LIST; } if (erasedType == AbstractList.class) { return VARS_ABSTRACT_LIST; } if (erasedType == Iterable.class) { return VARS_ITERABLE; } return erasedType.getTypeParameters(); } public static TypeVariable<?>[] paramsFor2(Class<?> erasedType)

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> { if (erasedType == Map.class) { return VARS_MAP; } if (erasedType == HashMap.class) { return VARS_HASH_MAP; } if (erasedType == LinkedHashMap.class) { return VARS_LINKED_HASH_MAP; } return erasedType.getTypeParameters(); } } /** * Helper type used to allow caching of generic types * * @since 2.8 */ final static class AsKey { private final Class<?> _raw; private final JavaType[] _params; private final int _hash; public AsKey(Class<?> raw, JavaType[] params, int hash) { _raw = raw ; _params = params; _hash = hash; } @Override public int hashCode() { return _hash; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; AsKey other = (AsKey) o; if ((_hash == other._hash) && (_raw == other._raw)) { final JavaType[] otherParams = other._params; final int len = _params.length; if (len == otherParams.length) { for (int i = 0; i < len; ++i) { if (!_params[i].equals(otherParams[i])) { return false; } } return true; } } return false; } @Override public String toString() { return _raw.getName()+"<>"; } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * This singleton value class is used to contain explicit JSON null * value. */ public final class NullNode extends ValueNode { // // Just need a fly-weight singleton public final static NullNode instance = new NullNode(); private NullNode() { } public static NullNode getInstance() { return instance; } @Override public JsonNodeType getNodeType() { return JsonNodeType.NULL; } @Override public JsonToken asToken() { return JsonToken.VALUE_NULL; } @Override public String asText(String defaultValue) { return defaultValue; } @Override public String asText() { return "null"; } // as with MissingNode, not considered number node; hence defaults are returned if provided /* public int asInt(int defaultValue); public long asLong(long defaultValue); public double asDouble(double defaultValue); public boolean asBoolean(boolean defaultValue); */ @Override public final void serialize(JsonGenerator g, SerializerProvider provider) throws IOException { provider.defaultSerializeNull(g); } @Override public boolean equals(Object o) { return (o == this); } @Override public int hashCode() { return JsonNodeType.NULL.ordinal(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(boolean defaultValue) { return _value != 0; } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof IntNode) { return ((IntNode) o)._value == _value; } return false; } @Override public int hashCode() { return _value; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> return new MapLikeType(rawType, bindings, superClass, superInterfaces, _keyType, _valueType, _valueHandler, _typeHandler, _asStatic); } @Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); if (_keyType != null) { sb.append('<'); sb.append(_keyType.toCanonical()); sb.append(','); sb.append(_valueType.toCanonical()); sb.append('>'); } return sb.toString(); } /* * /********************************************************** /* Public API * /********************************************************** */ @Override public boolean isContainerType() { return true; } @Override public boolean isMapLikeType() { return true; } @Override public JavaType getKeyType() { return _keyType; } @Override public JavaType getContentType() { return _valueType; } @Override public Object getContentValueHandler() { return _valueType.getValueHandler(); } @Override public Object getContentTypeHandler() { return _valueType.getTypeHandler(); } @Override public StringBuilder getErasedSignature(StringBuilder sb) { return _classSignature(_class, sb, true); } @Override public StringBuilder getGenericSignature(StringBuilder sb) { _classSignature(_class, sb, false); sb.append('<'); _keyType.getGenericSignature(sb); _valueType.getGenericSignature(sb); sb.append(">;"); return sb; } /* * /********************************************************** /* Extended * API /********************************************************** */ public MapLikeType withKeyTypeHandler(Object h) { return new MapLikeType(_class, _bindings, _superClass, _superInterfaces, _keyType.withTypeHandler(h), _valueType, _valueHandler, _typeHandler, _asStatic); } public MapLikeType withKeyValueHandler(Object h) { return new MapLikeType(_class, _bindings, _superClass, _superInterfaces, _keyType.withValueHandler(h), _valueType, _valueHandler, _typeHandler, _asStatic); } /** * Method that can be used for checking whether this type is a "real" * Collection type; meaning whether it represents a parameterized subtype of * {@link java.util.Collection} or just something that acts like one. */ public boolean isTrueMapType() { return Map.class.isAssignableFrom(_class); } /* * /********************************************************** /* Standard * methods /********************************************************** */ @Override public String toString() { return "[map-like type; class " + _class.getName() + ", " + _keyType + " -> " + _valueType + "]"; } @Override public boolean equals(Object o) { if (o == this) return true;

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> if (o == null) return false; if (o.getClass() != getClass()) return false; MapLikeType other = (MapLikeType) o; return (_class == other._class) && _keyType.equals(other._keyType) && _valueType.equals(other._valueType); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS><JsonNode> foundSoFar); public abstract List<String> findValuesAsText(String fieldName, List<String> foundSoFar); public abstract List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar); /* /********************************************************** /* Public API, path handling /********************************************************** */ /** * Method that can be called on Object nodes, to access a property * that has Object value; or if no such property exists, to create, * add and return such Object node. * If the node method is called on is not Object node, * or if property exists and has value that is not Object node, * {@link UnsupportedOperationException} is thrown */ public JsonNode with(String propertyName) { throw new UnsupportedOperationException("JsonNode not of type ObjectNode (but " +getClass().getName()+"), can not call with() on it"); } /** * Method that can be called on Object nodes, to access a property * that has <code>Array</code> value; or if no such property exists, to create, * add and return such Array node. * If the node method is called on is not Object node, * or if property exists and has value that is not Array node, * {@link UnsupportedOperationException} is thrown */ public JsonNode withArray(String propertyName) { throw new UnsupportedOperationException("JsonNode not of type ObjectNode (but " +getClass().getName()+"), can not call withArray() on it"); } /* /********************************************************** /* Public API, comparison /********************************************************** */ /** * Entry method for invoking customizable comparison, using passed-in * {@link Comparator} object. Nodes will handle traversal of structured * types (arrays, objects), but defer to comparator for scalar value * comparisons. If a "natural" {@link Comparator} is passed -- one that * simply calls <code>equals()</code> on one of arguments, passing the other * -- implementation is the same as directly calling <code>equals()</code> * on node. *<p> * Default implementation simply delegates to passed in <code>comparator</code>, * with <code>this</code> as the first argument, and <code>other</code> as * the second argument. * * @param comparator Object called to compare two scalar {@link JsonNode} * instances, and return either 0 (are equals) or non-zero (not equal) * * @since 2.6 */ public boolean equals(Comparator<JsonNode> comparator, JsonNode other) { return comparator.compare(this, other) == 0; } /* /********************************************************** /* Overridden standard methods /********************************************************** */ /** * Method that will produce developer-readable representation of the * node; which may <b>or may not</b> be as valid JSON. * If you want valid JSON output (or output formatted using one of

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * other Jackson supported data formats) make sure to use * {@link ObjectMapper} or {@link ObjectWriter} to serialize an * instance, for example: *<pre> * String json = objectMapper.writeValueAsString(rootNode); *</pre> *<p> * Note: method defined as abstract to ensure all implementation * classes explicitly implement method, instead of relying * on {@link Object#toString()} definition. */ @Override public abstract String toString(); /** * Equality for node objects is defined as full (deep) value * equality. This means that it is possible to compare complete * JSON trees for equality by comparing equality of root nodes. *<p> * Note: marked as abstract to ensure all implementation * classes define it properly and not rely on definition * from {@link java.lang.Object}. */ @Override public abstract boolean equals(Object o); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.exc; import java.util.*; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonMappingException; /** * Specialized {@link JsonMappingException} sub-class used to indicate * case where an explicitly ignored property is encountered, and mapper * is configured to consider this an error. * * @since 2.3 */ public class IgnoredPropertyException extends PropertyBindingException { private static final long serialVersionUID = 1L; /** * @since 2.7 */ public IgnoredPropertyException(JsonParser p, String msg, JsonLocation loc, Class<?> referringClass, String propName, Collection<Object> propertyIds) { super(p, msg, loc, referringClass, propName, propertyIds); } /** * @deprecated Since 2.7 */ @Deprecated public IgnoredPropertyException(String msg, JsonLocation loc, Class<?> referringClass, String propName, Collection<Object> propertyIds) { super(msg, loc, referringClass, propName, propertyIds); } /** * Factory method used for constructing instances of this exception type. * * @param p Underlying parser used for reading input being used for data-binding * @param fromObjectOrClass Reference to either instance of problematic type ( * if available), or if not, type itself * @param propertyName Name of unrecognized property * @param propertyIds (optional, null if not available) Set of properties that * type would recognize, if completely known: null if set can not be determined. */ public static IgnoredPropertyException from(JsonParser p, Object fromObjectOrClass, String propertyName, Collection<Object> propertyIds) { if (fromObjectOrClass == null) { throw new IllegalArgumentException(); } Class<?> ref; if (fromObjectOrClass instanceof Class<?>) { ref = (Class<?>) fromObjectOrClass; } else { ref = fromObjectOrClass.getClass(); } String msg = "Ignored field \""+propertyName+"\" (class "+ref.getName() +") encountered; mapper configured not to allow this"; IgnoredPropertyException e = new IgnoredPropertyException(p, msg, p.getCurrentLocation(), ref, propertyName, propertyIds); // but let's also ensure path includes this last (missing) segment e.prependPath(fromObjectOrClass, propertyName); return e; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>) { super(src._handledType); // Bit clumsy, but has to do: HashSet<String> ignoredSet = ArrayBuilders.arrayToSet(toIgnore); final BeanPropertyWriter[] propsIn = src._props; final BeanPropertyWriter[] fpropsIn = src._filteredProps; final int len = propsIn.length; ArrayList<BeanPropertyWriter> propsOut = new ArrayList<BeanPropertyWriter>(len); ArrayList<BeanPropertyWriter> fpropsOut = (fpropsIn == null) ? null : new ArrayList<BeanPropertyWriter>(len); for (int i = 0; i < len; ++i) { BeanPropertyWriter bpw = propsIn[i]; // should be ignored? if (ignoredSet.contains(bpw.getName())) { continue; } propsOut.add(bpw); if (fpropsIn != null) { fpropsOut.add(fpropsIn[i]); } } _props = propsOut.toArray(new BeanPropertyWriter[propsOut.size()]); _filteredProps = (fpropsOut == null) ? null : fpropsOut.toArray(new BeanPropertyWriter[fpropsOut.size()]); _typeId = src._typeId; _anyGetterWriter = src._anyGetterWriter; _objectIdWriter = src._objectIdWriter; _propertyFilterId = src._propertyFilterId; _serializationShape = src._serializationShape; } /** * Mutant factory used for creating a new instance with different * {@link ObjectIdWriter}. * * @since 2.0 */ public abstract BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter); /** * Mutant factory used for creating a new instance with additional * set of properties to ignore (from properties this instance otherwise has) * * @since 2.0 */ protected abstract BeanSerializerBase withIgnorals(String[] toIgnore); /** * Mutant factory for creating a variant that output POJO as a * JSON Array. Implementations may ignore this request if output * as array is not possible (either at all, or reliably). * * @since 2.1 */ protected abstract BeanSerializerBase asArraySerializer(); /** * Mutant factory used for creating a new instance with different * filter id (used with <code>JsonFilter</code> annotation) * * @since 2.3 */ @Override public abstract BeanSerializerBase withFilterId(Object filterId); /** * Copy-constructor that is useful for sub-classes that just want to * copy all super-class properties without modifications. */ protected BeanSerializerBase(BeanSerializerBase src) { this(src, src._props, src._filteredProps); } /** * Copy-constructor that will also rename properties with given prefix * (if it's non-empty)

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>i == len) { throw new IllegalArgumentException("Invalid Object Id definition for "+_handledType.getName() +": can not find property with name '"+propName+"'"); } BeanPropertyWriter prop = _props[i]; if (propName.equals(prop.getName())) { idProp = prop; /* Let's force it to be the first property to output * (although it may still get rearranged etc) */ if (i > 0) { // note: must shuffle both regular properties and filtered System.arraycopy(_props, 0, _props, 1, i); _props[0] = idProp; if (_filteredProps != null) { BeanPropertyWriter fp = _filteredProps[i]; System.arraycopy(_filteredProps, 0, _filteredProps, 1, i); _filteredProps[0] = fp; } } break; } } idType = idProp.getType(); gen = new PropertyBasedObjectIdGenerator(objectIdInfo, idProp); oiw = ObjectIdWriter.construct(idType, (PropertyName) null, gen, objectIdInfo.getAlwaysAsId()); } else { // other types need to be simpler gen = provider.objectIdGeneratorInstance(accessor, objectIdInfo); oiw = ObjectIdWriter.construct(idType, objectIdInfo.getPropertyName(), gen, objectIdInfo.getAlwaysAsId()); } } // Or change Filter Id in use? Object filterId = intr.findFilterId(accessor); if (filterId != null) { // but only consider case of adding a new filter id (no removal via annotation) if (_propertyFilterId == null || !filterId.equals(_propertyFilterId)) { newFilterId = filterId; } } } // either way, need to resolve serializer: BeanSerializerBase contextual = this; if (oiw != null) { JsonSerializer<?> ser = provider.findValueSerializer(oiw.idType, property); oiw = oiw.withSerializer(ser); if (oiw != _objectIdWriter) { contextual = contextual.withObjectIdWriter(oiw); } } // And possibly add more properties to ignore if (ignorals != null && ignorals.length != 0) { contextual = contextual.withIgnorals(ignorals); } if (newFilterId != null) { contextual = contextual.withFilterId(newFilterId); } if (shape == null) { shape = _serializationShape; } if (shape == JsonFormat.Shape.ARRAY) { return contextual.asArraySerializer(); } return contextual; } /* /********************************************************** /* Accessors /********************************************************** */ @Override public Iterator<PropertyWriter> properties() { return Arrays.<Property

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> provider, w)) { return; } // If not, need to inject the id: Object id = objectId.generateId(bean); if (w.alwaysAsId) { w.serializer.serialize(id, gen, provider); return; } _serializeObjectId(bean, gen, provider, typeSer, objectId); } protected void _serializeObjectId(Object bean, JsonGenerator gen,SerializerProvider provider, TypeSerializer typeSer, WritableObjectId objectId) throws IOException { final ObjectIdWriter w = _objectIdWriter; String typeStr = (_typeId == null) ? null :_customTypeId(bean); if (typeStr == null) { typeSer.writeTypePrefixForObject(bean, gen); } else { typeSer.writeCustomTypePrefixForObject(bean, gen, typeStr); } objectId.writeAsField(gen, provider, w); if (_propertyFilterId != null) { serializeFieldsFiltered(bean, gen, provider); } else { serializeFields(bean, gen, provider); } if (typeStr == null) { typeSer.writeTypeSuffixForObject(bean, gen); } else { typeSer.writeCustomTypeSuffixForObject(bean, gen, typeStr); } } protected final String _customTypeId(Object bean) { final Object typeId = _typeId.getValue(bean); if (typeId == null) { return ""; } return (typeId instanceof String) ? (String) typeId : typeId.toString(); } /* /********************************************************** /* Field serialization methods /********************************************************** */ protected void serializeFields(Object bean, JsonGenerator gen, SerializerProvider provider) throws IOException { final BeanPropertyWriter[] props; if (_filteredProps != null && provider.getActiveView() != null) { props = _filteredProps; } else { props = _props; } int i = 0; try { for (final int len = props.length; i < len; ++i) { BeanPropertyWriter prop = props[i]; if (prop != null) { // can have nulls in filtered list prop.serializeAsField(bean, gen, provider); } } if (_anyGetterWriter != null) { _anyGetterWriter.getAndSerialize(bean, gen, provider); } } catch (Exception e) { String name = (i == props.length) ? "[anySetter]" : props[i].getName(); wrapAndThrow(provider, e, bean, name); } catch (StackOverflowError e) { /* 04-Sep-2009, tatu: Dealing with this is tricky, since we do not * have many stack frames to spare... just one or two; can't * make many calls. */

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> // 10-Dec-2015, tatu: and due to above, avoid "from" method, call ctor directly: //JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e); JsonMappingException mapE = new JsonMappingException(gen, "Infinite recursion (StackOverflowError)", e); String name = (i == props.length) ? "[anySetter]" : props[i].getName(); mapE.prependPath(new JsonMappingException.Reference(bean, name)); throw mapE; } } /** * Alternative serialization method that gets called when there is a * {@link PropertyFilter} that needs to be called to determine * which properties are to be serialized (and possibly how) */ protected void serializeFieldsFiltered(Object bean, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException { /* note: almost verbatim copy of "serializeFields"; copied (instead of merged) * so that old method need not add check for existence of filter. */ final BeanPropertyWriter[] props; if (_filteredProps != null && provider.getActiveView() != null) { props = _filteredProps; } else { props = _props; } final PropertyFilter filter = findPropertyFilter(provider, _propertyFilterId, bean); // better also allow missing filter actually.. if (filter == null) { serializeFields(bean, gen, provider); return; } int i = 0; try { for (final int len = props.length; i < len; ++i) { BeanPropertyWriter prop = props[i]; if (prop != null) { // can have nulls in filtered list filter.serializeAsField(bean, gen, provider, prop); } } if (_anyGetterWriter != null) { _anyGetterWriter.getAndFilter(bean, gen, provider, filter); } } catch (Exception e) { String name = (i == props.length) ? "[anySetter]" : props[i].getName(); wrapAndThrow(provider, e, bean, name); } catch (StackOverflowError e) { // Minimize call depth since we are close to fail: //JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e); JsonMappingException mapE = new JsonMappingException(gen, "Infinite recursion (StackOverflowError)", e); String name = (i == props.length) ? "[anySetter]" : props[i].getName(); mapE.prependPath(new JsonMappingException.Reference(bean, name)); throw mapE; } } @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { ObjectNode o = createSchemaNode("object", true); //

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> ,B { @Override public void foobar() { } } ; public abstract void foobar(); } public enum ABC { A, B, C; } /* /********************************************************** /* Shared serializers /********************************************************** */ @SuppressWarnings("serial") public static class UpperCasingSerializer extends StdScalarSerializer<String> { public UpperCasingSerializer() { super(String.class); } @Override public void serialize(String value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeString(value.toUpperCase()); } } @SuppressWarnings("serial") public static class LowerCasingDeserializer extends StdScalarDeserializer<String> { public LowerCasingDeserializer() { super(String.class); } @Override public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { return p.getText().toLowerCase(); } } /* /********************************************************** /* Construction /********************************************************** */ protected BaseMapTest() { super(); } /* /********************************************************** /* Factory methods /********************************************************** */ private final static ObjectMapper SHARED_MAPPER = new ObjectMapper(); protected ObjectMapper objectMapper() { return SHARED_MAPPER; } protected ObjectWriter objectWriter() { return SHARED_MAPPER.writer(); } protected ObjectReader objectReader() { return SHARED_MAPPER.reader(); } protected ObjectReader objectReader(Class<?> cls) { return SHARED_MAPPER.readerFor(cls); } // @since 2.7 protected TypeFactory newTypeFactory() { // this is a work-around; no null modifier added return TypeFactory.defaultInstance().withModifier(null); } /* /********************************************************** /* Additional assert methods /********************************************************** */ protected void assertEquals(int[] exp, int[] act) { assertArrayEquals(exp, act); } /** * Helper method for verifying 3 basic cookie cutter cases; * identity comparison (true), and against null (false), * or object of different type (false) */ protected void assertStandardEquals(Object o) { assertTrue(o.equals(o)); assertFalse(o.equals(null)); assertFalse(o.equals(SINGLETON_OBJECT)); // just for fun, let's also call hash code... o.hashCode(); } /* /********************************************************** /* Helper methods, serialization /********************************************************** */ @SuppressWarnings("unchecked") protected Map<String,Object> writeAndMap(ObjectMapper m, Object value) throws IOException { String str = m.writeValueAsString(value); return (Map<String,Object>) m.readValue(str, Map.class); } protected String serializeAsString(ObjectMapper m, Object value) throws IOException { return m.writeValueAsString(value); } protected String serializeAsString(Object

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 64-bit integer values. */ public class LongNode extends NumericNode { protected final long _value; /* ************************************************ * Construction ************************************************ */ public LongNode(long v) { _value = v; } public static LongNode valueOf(long l) { return new LongNode(l); } /* ************************************************ * Overrridden JsonNode methods ************************************************ */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.LONG; } @Override public boolean isIntegralNumber() { return true; } @Override public boolean isLong() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return true; } @Override public Number numberValue() { return Long.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return _value; } @Override public float floatValue() { return _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return BigInteger.valueOf(_value); } @Override public String asText() { return NumberOutput.toString(_value); } @Override public boolean asBoolean(boolean defaultValue) { return _value != 0; } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof LongNode) { return ((LongNode) o)._value == _value; } return false; } @Override public int hashCode() { return ((int) _value) ^ (int) (_value >> 32); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> String toString() { return "[array type, component type: "+_componentType+"]"; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; ArrayType other = (ArrayType) o; return _componentType.equals(other._componentType); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> type coercions /********************************************************** */ @Override public String asText() { return _value; } @Override public String asText(String defaultValue) { return (_value == null) ? defaultValue : _value; } // note: neither fast nor elegant, but these work for now: @Override public boolean asBoolean(boolean defaultValue) { if (_value != null) { String v = _value.trim(); if ("true".equals(v)) { return true; } if ("false".equals(v)) { return false; } } return defaultValue; } @Override public int asInt(int defaultValue) { return NumberInput.parseAsInt(_value, defaultValue); } @Override public long asLong(long defaultValue) { return NumberInput.parseAsLong(_value, defaultValue); } @Override public double asDouble(double defaultValue) { return NumberInput.parseAsDouble(_value, defaultValue); } /* /********************************************************** /* Serialization /********************************************************** */ @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException { if (_value == null) { jg.writeNull(); } else { jg.writeString(_value); } } /* /********************************************************** /* Overridden standard methods /********************************************************** */ @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof TextNode) { return ((TextNode) o)._value.equals(_value); } return false; } @Override public int hashCode() { return _value.hashCode(); } /** * Different from other values, Strings need quoting */ @Override public String toString() { int len = _value.length(); len = len + 2 + (len >> 4); StringBuilder sb = new StringBuilder(len); appendQuoted(sb, _value); return sb.toString(); } protected static void appendQuoted(StringBuilder sb, String content) { sb.append('"'); CharTypes.appendQuoted(sb, content); sb.append('"'); } /* /********************************************************** /* Helper methods /********************************************************** */ protected void _reportInvalidBase64(Base64Variant b64variant, char ch, int bindex) throws JsonParseException { _reportInvalidBase64(b64variant, ch, bindex, null); } /** * @param bindex Relative index within base64 character unit; between 0 * and 3 (as unit has exactly 4 characters) */ protected void _reportInvalidBase64(Base64Variant b64variant, char ch, int bindex, String msg) throws JsonParseException

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind; import java.lang.annotation.Annotation; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.util.Annotations; import com.fasterxml.jackson.databind.util.Named; /** * Bean properties are logical entities that represent data * that Java objects (POJOs (Plain Old Java Objects), sometimes also called "beans") * contain; and that are accessed using accessors (methods like getters * and setters, fields, constructor parametrers). * Instances allow access to annotations directly associated * to property (via field or method), as well as contextual * annotations (annotations for class that contains properties). *<p> * Instances are not typically passed when constructing serializers * and deserializers, but rather only passed when context * is known when * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer} and * {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer} * resolution occurs (<code>createContextual(...)</code> method is called). * References may (need to) be retained by serializers and deserializers, * especially when further resolving dependant handlers like value * serializers/deserializers or structured types. */ public interface BeanProperty extends Named { public final static JsonFormat.Value EMPTY_FORMAT = new JsonFormat.Value(); public final static JsonInclude.Value EMPTY_INCLUDE = JsonInclude.Value.empty(); /** * Method to get logical name of the property */ @Override public String getName(); /** * Method for getting full name definition, including possible * format-specific additional properties (such as namespace when * using XML backend). * * @since 2.3 */ public PropertyName getFullName(); /** * Method to get declared type of the property. */ public JavaType getType(); /** * If property is indicated to be wrapped, name of * wrapper element to use. * * @since 2.2 */ public PropertyName getWrapperName(); /** * Accessor for additional optional information about property. * * @since 2.3 * * @return Metadata about property; never null. */ public PropertyMetadata getMetadata(); /** * Whether value for property is marked as required using * annotations or associated schema. * Equivalent to: *<code> * getMetadata().isRequired() *</code> * * @since 2.2 */ public boolean isRequired(); /** * Accessor for checking whether there is an actual physical property

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Class<?> baseType) { JsonFormat.Value v0 = config.getDefaultPropertyFormat(baseType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); if ((intr == null) || (_member == null)) { return v0; } JsonFormat.Value v = intr.findFormat(_member); if (v == null) { return v0; } return v0.withOverrides(v); } @Override public JsonInclude.Value findPropertyInclusion(MapperConfig<?> config, Class<?> baseType) { JsonInclude.Value v0 = config.getDefaultPropertyInclusion(baseType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); if ((intr == null) || (_member == null)) { return v0; } JsonInclude.Value v = intr.findPropertyInclusion(_member); if (v == null) { return v0; } return v0.withOverrides(v); } @Override public String getName() { return _name.getSimpleName(); } @Override public PropertyName getFullName() { return _name; } @Override public JavaType getType() { return _type; } @Override public PropertyName getWrapperName() { return _wrapperName; } @Override public boolean isRequired() { return _metadata.isRequired(); } @Override public PropertyMetadata getMetadata() { return _metadata; } @Override public AnnotatedMember getMember() { return _member; } /** *<p> * TODO: move to {@link BeanProperty} in near future, once all standard * implementations define it. * * @since 2.5 */ @Override public boolean isVirtual() { return false; } /** * Implementation of this method throws * {@link UnsupportedOperationException}, since instances of this * implementation should not be used as part of actual structure * visited. Rather, other implementations should handle it. */ @Override public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) { throw new UnsupportedOperationException("Instances of "+getClass().getName()+" should not get visited"); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind; import java.lang.reflect.Modifier; import java.util.List; import com.fasterxml.jackson.core.type.ResolvedType; import com.fasterxml.jackson.databind.type.TypeBindings; import com.fasterxml.jackson.databind.type.TypeFactory; /** * Base class for type token classes used both to contain information * and as keys for deserializers. *<p> * Instances can (only) be constructed by * <code>com.fasterxml.jackson.databind.type.TypeFactory</code>. *<p> * Since 2.2 this implements {@link java.lang.reflect.Type} to allow * it to be pushed through interfaces that only expose that type. */ public abstract class JavaType extends ResolvedType implements java.io.Serializable, // 2.1 java.lang.reflect.Type // 2.2 { private static final long serialVersionUID = 1; /** * This is the nominal type-erased Class that would be close to the * type represented (but not exactly type, due to type erasure: type * instance may have more information on this). * May be an interface or abstract class, so instantiation * may not be possible. */ protected final Class<?> _class; protected final int _hash; /** * Optional handler (codec) that can be attached to indicate * what to use for handling (serializing, deserializing) values of * this specific type. *<p> * Note: untyped (i.e. caller has to cast) because it is used for * different kinds of handlers, with unrelated types. */ protected final Object _valueHandler; /** * Optional handler that can be attached to indicate how to handle * additional type metadata associated with this type. *<p> * Note: untyped (i.e. caller has to cast) because it is used for * different kinds of handlers, with unrelated types. */ protected final Object _typeHandler; /** * Whether entities defined with this type should be handled using * static typing (as opposed to dynamic runtime type) or not. * * @since 2.2 */ protected final boolean _asStatic; /* /********************************************************** /* Life-cycle /********************************************************** */ /** * @param raw "Raw" (type-erased) class for this type * @param additionalHash Additional hash code to use, in addition * to hash code of the class name */ protected JavaType(Class<?> raw, int additionalHash, Object valueHandler, Object typeHandler, boolean asStatic) { _class = raw; _hash = raw.getName().hashCode() + additionalHash; _valueHandler = valueHandler; _typeHandler = typeHandler; _asStatic = asStatic; } /**

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>********************************************************** */ //public abstract String toCanonical(); /** * Method for accessing signature that contains generic * type information, in form compatible with JVM 1.5 * as per JLS. It is a superset of {@link #getErasedSignature}, * in that generic information can be automatically removed * if necessary (just remove outermost * angle brackets along with content inside) */ public String getGenericSignature() { StringBuilder sb = new StringBuilder(40); getGenericSignature(sb); return sb.toString(); } /** * * @param sb StringBuilder to append signature to * * @return StringBuilder that was passed in; returned to allow * call chaining */ public abstract StringBuilder getGenericSignature(StringBuilder sb); /** * Method for accessing signature without generic * type information, in form compatible with all versions * of JVM, and specifically used for type descriptions * when generating byte code. */ public String getErasedSignature() { StringBuilder sb = new StringBuilder(40); getErasedSignature(sb); return sb.toString(); } /** * Method for accessing signature without generic * type information, in form compatible with all versions * of JVM, and specifically used for type descriptions * when generating byte code. * * @param sb StringBuilder to append signature to * * @return StringBuilder that was passed in; returned to allow * call chaining */ public abstract StringBuilder getErasedSignature(StringBuilder sb); /* /********************************************************** /* Standard methods; let's make them abstract to force override /********************************************************** */ @Override public abstract String toString(); @Override public abstract boolean equals(Object o); @Override public final int hashCode() { return _hash; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Annotations, AnnotatedParameter param, int index, Object injectableValueId, PropertyMetadata metadata) { super(name, type, wrapperName, typeDeser, contextAnnotations, metadata); _annotated = param; _creatorIndex = index; _injectableValueId = injectableValueId; _fallbackSetter = null; } /** * @since 2.3 */ protected CreatorProperty(CreatorProperty src, PropertyName newName) { super(src, newName); _annotated = src._annotated; _creatorIndex = src._creatorIndex; _injectableValueId = src._injectableValueId; _fallbackSetter = src._fallbackSetter; } protected CreatorProperty(CreatorProperty src, JsonDeserializer<?> deser) { super(src, deser); _annotated = src._annotated; _creatorIndex = src._creatorIndex; _injectableValueId = src._injectableValueId; _fallbackSetter = src._fallbackSetter; } @Override public CreatorProperty withName(PropertyName newName) { return new CreatorProperty(this, newName); } @Override public CreatorProperty withValueDeserializer(JsonDeserializer<?> deser) { return new CreatorProperty(this, deser); } /** * NOTE: one exception to immutability, due to problems with CreatorProperty instances * being shared between Bean, separate PropertyBasedCreator * * @since 2.6.0 */ public void setFallbackSetter(SettableBeanProperty fallbackSetter) { _fallbackSetter = fallbackSetter; } /** * Method that can be called to locate value to be injected for this * property, if it is configured for this. */ public Object findInjectableValue(DeserializationContext context, Object beanInstance) { if (_injectableValueId == null) { throw new IllegalStateException("Property '"+getName() +"' (type "+getClass().getName()+") has no injectable value id configured"); } return context.findInjectableValue(_injectableValueId, this, beanInstance); } /** * Method to find value to inject, and inject it to this property. */ public void inject(DeserializationContext context, Object beanInstance) throws IOException { set(beanInstance, findInjectableValue(context, beanInstance)); } /* /********************************************************** /* BeanProperty impl /********************************************************** */ @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { if (_annotated == null) { return null; } return _annotated.getAnnotation(acls); } @Override public AnnotatedMember getMember() { return _annotated; } @Override public int getCreatorIndex() { return _creatorIndex; } /* /********************************************************** /* Overridden methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> instance) throws IOException, JsonProcessingException { set(instance, deserialize(jp, ctxt)); } @Override public Object deserializeSetAndReturn(JsonParser jp, DeserializationContext ctxt, Object instance) throws IOException, JsonProcessingException { return setAndReturn(instance, deserialize(jp, ctxt)); } @Override public void set(Object instance, Object value) throws IOException { /* Hmmmh. Should we return quietly (NOP), or error? * Perhaps better to throw an exception, since it's generally an error. */ if (_fallbackSetter == null) { throw new IllegalStateException("No fallback setter/field defined: can not use creator property for " +getClass().getName()); } _fallbackSetter.set(instance, value); } @Override public Object setAndReturn(Object instance, Object value) throws IOException { if (_fallbackSetter == null) { throw new IllegalStateException("No fallback setter/field defined: can not use creator property for " +getClass().getName()); } return _fallbackSetter.setAndReturn(instance, value); } @Override public Object getInjectableValueId() { return _injectableValueId; } @Override public String toString() { return "[creator property, name '"+getName()+"'; inject id '"+_injectableValueId+"']"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 16-bit integer values. */ public class ShortNode extends NumericNode { protected final short _value; /* ************************************************ * Construction ************************************************ */ public ShortNode(short v) { _value = v; } public static ShortNode valueOf(short l) { return new ShortNode(l); } /* ************************************************ * Overridden JsonNode methods ************************************************ */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.INT; } // should be SHORT @Override public boolean isIntegralNumber() { return true; } @Override public boolean isShort() { return true; } @Override public boolean canConvertToInt() { return true; } @Override public boolean canConvertToLong() { return true; } @Override public Number numberValue() { return Short.valueOf(_value); } @Override public short shortValue() { return _value; } @Override public int intValue() { return _value; } @Override public long longValue() { return _value; } @Override public float floatValue() { return _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return BigInteger.valueOf(_value); } @Override public String asText() { return NumberOutput.toString(_value); } @Override public boolean asBoolean(boolean defaultValue) { return _value != 0; } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof ShortNode) { return ((ShortNode) o)._value == _value; } return false; } @Override public int hashCode() { return _value; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> actual converter instance, or Class for instantiating one. * * @since 2.2 */ @SuppressWarnings("unchecked") public Converter<Object,Object> converterInstance(Annotated annotated, Object converterDef) throws JsonMappingException { if (converterDef == null) { return null; } if (converterDef instanceof Converter<?,?>) { return (Converter<Object,Object>) converterDef; } if (!(converterDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned Converter definition of type " +converterDef.getClass().getName()+"; expected type Converter or Class<Converter> instead"); } Class<?> converterClass = (Class<?>)converterDef; // there are some known "no class" markers to consider too: if (converterClass == Converter.None.class || ClassUtil.isBogusClass(converterClass)) { return null; } if (!Converter.class.isAssignableFrom(converterClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class " +converterClass.getName()+"; expected Class<Converter>"); } final MapperConfig<?> config = getConfig(); HandlerInstantiator hi = config.getHandlerInstantiator(); Converter<?,?> conv = (hi == null) ? null : hi.converterInstance(config, annotated, converterClass); if (conv == null) { conv = (Converter<?,?>) ClassUtil.createInstance(converterClass, config.canOverrideAccessModifiers()); } return (Converter<Object,Object>) conv; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * <code>JsonNode</code> implementation for efficiently containing 32-bit * `float` values. * * @since 2.2 */ public class FloatNode extends NumericNode { protected final float _value; /* /********************************************************** /* Construction /********************************************************** */ public FloatNode(float v) { _value = v; } public static FloatNode valueOf(float v) { return new FloatNode(v); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.FLOAT; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isFloat() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return (_value >= Long.MIN_VALUE && _value <= Long.MAX_VALUE); } @Override public Number numberValue() { return Float.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return (long) _value; } @Override public float floatValue() { return (float) _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); } @Override public String asText() { // As per [jackson-databind#707] // return NumberOutput.toString(_value); // TODO: in 2.7, call `NumberOutput.toString (added in 2.6); not yet for backwards compat return Float.toString(_value); } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException { jg.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof FloatNode) { // We must account for NaNs: NaN does

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; import java.lang.reflect.Type; import java.util.Map; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Container class for serializers used for handling standard JDK-provided * types. */ @SuppressWarnings("serial") public class NumberSerializers { protected NumberSerializers() { } public static void addAll(Map<String, JsonSerializer<?>> allDeserializers) { final JsonSerializer<?> intS = new IntegerSerializer(); allDeserializers.put(Integer.class.getName(), intS); allDeserializers.put(Integer.TYPE.getName(), intS); allDeserializers.put(Long.class.getName(), LongSerializer.instance); allDeserializers.put(Long.TYPE.getName(), LongSerializer.instance); allDeserializers.put(Byte.class.getName(), IntLikeSerializer.instance); allDeserializers.put(Byte.TYPE.getName(), IntLikeSerializer.instance); allDeserializers.put(Short.class.getName(), ShortSerializer.instance); allDeserializers.put(Short.TYPE.getName(), ShortSerializer.instance); // Numbers, limited length floating point allDeserializers.put(Float.class.getName(), FloatSerializer.instance); allDeserializers.put(Float.TYPE.getName(), FloatSerializer.instance); allDeserializers.put(Double.class.getName(), DoubleSerializer.instance); allDeserializers.put(Double.TYPE.getName(), DoubleSerializer.instance); } /* /********************************************************** /* Shared base class /********************************************************** */ protected abstract static class Base<T> extends StdScalarSerializer<T> implements ContextualSerializer { protected final JsonParser.NumberType _numberType; protected final String _schemaType; protected final boolean _isInt; protected Base(Class<?> cls, JsonParser.NumberType numberType, String schemaType) { super(cls, false); _numberType = numberType; _schemaType = schemaType; _isInt = (numberType == JsonParser.NumberType.INT) || (numberType == JsonParser.NumberType.LONG) || (numberType == JsonParser.NumberType.BIG_INTEGER); } @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode(_schemaType, true); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> by propagating setting to JsonGenerator // so this should not be needed: /* if (provider.isEnabled(SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN)) { if (!(jgen instanceof TokenBuffer)) { // [Issue#232] jgen.writeNumber(((BigDecimal) _value).toPlainString()); return; } } */ jgen.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof DecimalNode) { return ((DecimalNode) o)._value.compareTo(_value) == 0; } return false; } @Override public int hashCode() { return Double.valueOf(doubleValue()).hashCode(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; public class StackTraceElementDeserializer extends StdScalarDeserializer<StackTraceElement> { private static final long serialVersionUID = 1L; public StackTraceElementDeserializer() { super(StackTraceElement.class); } @Override public StackTraceElement deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); // Must get an Object if (t == JsonToken.START_OBJECT) { String className = "", methodName = "", fileName = ""; int lineNumber = -1; while ((t = jp.nextValue()) != JsonToken.END_OBJECT) { String propName = jp.getCurrentName(); if ("className".equals(propName)) { className = jp.getText(); } else if ("fileName".equals(propName)) { fileName = jp.getText(); } else if ("lineNumber".equals(propName)) { if (t.isNumeric()) { lineNumber = jp.getIntValue(); } else { throw JsonMappingException.from(jp, "Non-numeric token ("+t+") for property 'lineNumber'"); } } else if ("methodName".equals(propName)) { methodName = jp.getText(); } else if ("nativeMethod".equals(propName)) { // no setter, not passed via constructor: ignore } else { handleUnknownProperty(jp, ctxt, _valueClass, propName); } } return new StackTraceElement(className, methodName, fileName, lineNumber); } else if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final StackTraceElement value = deserialize(jp, ctxt); if (jp.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'java.lang.StackTraceElement' value but there was more than a single value in the array" ); } return value; } throw ctxt.mappingException(_valueClass, t); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.Annotations; /** * This concrete sub-class implements property that is set * directly assigning to a Field. */ public final class FieldProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; final protected AnnotatedField _annotated; /** * Actual field to set when deserializing this property. * Transient since there is no need to persist; only needed during * construction of objects. */ final protected transient Field _field; public FieldProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedField field) { super(propDef, type, typeDeser, contextAnnotations); _annotated = field; _field = field.getAnnotated(); } protected FieldProperty(FieldProperty src, JsonDeserializer<?> deser) { super(src, deser); _annotated = src._annotated; _field = src._field; } protected FieldProperty(FieldProperty src, PropertyName newName) { super(src, newName); _annotated = src._annotated; _field = src._field; } /** * Constructor used for JDK Serialization when reading persisted object */ protected FieldProperty(FieldProperty src) { super(src); _annotated = src._annotated; Field f = _annotated.getAnnotated(); if (f == null) { throw new IllegalArgumentException("Missing field (broken JDK (de)serialization?)"); } _field = f; } @Override public FieldProperty withName(PropertyName newName) { return new FieldProperty(this, newName); } @Override public FieldProperty withValueDeserializer(JsonDeserializer<?> deser) { return new FieldProperty(this, deser); } /* /********************************************************** /* BeanProperty impl /********************************************************** */ @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return (_annotated == null) ? null : _annotated.getAnnotation(acls); } @Override public AnnotatedMember getMember() { return _annotated; } /* /********************************************************** /* Overridden methods /********************************************************** */ @Override

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser.impl; import com.fasterxml.jackson.annotation.ObjectIdGenerator; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.databind.introspect.ObjectIdInfo; import com.fasterxml.jackson.databind.ser.*; public class PropertyBasedObjectIdGenerator extends ObjectIdGenerators.PropertyGenerator { private static final long serialVersionUID = 1L; protected final BeanPropertyWriter _property; public PropertyBasedObjectIdGenerator(ObjectIdInfo oid, BeanPropertyWriter prop) { this(oid.getScope(), prop); } protected PropertyBasedObjectIdGenerator(Class<?> scope, BeanPropertyWriter prop) { super(scope); _property = prop; } /** * We must override this method, to prevent errors when scopes are the same, * but underlying class (on which to access property) is different. */ @Override public boolean canUseFor(ObjectIdGenerator<?> gen) { if (gen.getClass() == getClass()) { PropertyBasedObjectIdGenerator other = (PropertyBasedObjectIdGenerator) gen; if (other.getScope() == _scope) { /* 26-Jul-2012, tatu: This is actually not enough, because the property * accessor within BeanPropertyWriter won't work for other property fields * (see [https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/9] * for details). * So we need to verify that underlying property is actually the same. */ return (other._property == _property); } } return false; } @Override public Object generateId(Object forPojo) { try { return _property.get(forPojo); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Problem accessing property '" +_property.getName()+"': "+e.getMessage(), e); } } @Override public ObjectIdGenerator<Object> forScope(Class<?> scope) { return (scope == _scope) ? this : new PropertyBasedObjectIdGenerator(scope, _property); } @Override public ObjectIdGenerator<Object> newForSerialization(Object context) { // No state, can return this return this; } @Override public com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey key(Object key) { if (key == null) { return null; } // should we use general type for all; or type of property itself? return new IdKey(getClass(), _scope, key); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>not considering * method signature or name, just visibility) */ public boolean isGetterVisible(Method m); public boolean isGetterVisible(AnnotatedMethod m); /** * Method for checking whether given method is auto-detectable * as is-getter, with respect to its visibility (not considering * method signature or name, just visibility) */ public boolean isIsGetterVisible(Method m); public boolean isIsGetterVisible(AnnotatedMethod m); /** * Method for checking whether given method is auto-detectable * as setter, with respect to its visibility (not considering * method signature or name, just visibility) */ public boolean isSetterVisible(Method m); public boolean isSetterVisible(AnnotatedMethod m); /** * Method for checking whether given method is auto-detectable * as Creator, with respect to its visibility (not considering * method signature or name, just visibility) */ public boolean isCreatorVisible(Member m); public boolean isCreatorVisible(AnnotatedMember m); /** * Method for checking whether given field is auto-detectable * as property, with respect to its visibility (not considering * method signature or name, just visibility) */ public boolean isFieldVisible(Field f); public boolean isFieldVisible(AnnotatedField f); /* /******************************************************** /* Standard implementation suitable for basic use /******************************************************** */ /** * Default standard implementation is purely based on visibility * modifier of given class members, and its configured minimum * levels. * Implemented using "builder" (or "Fluent") pattern, whereas instances * are immutable, and configuration is achieved by chainable factory * methods. As a result, type is declared is funky recursive generic * type, to allow for sub-classing of build methods with property type * co-variance. *<p> * Note on <code>JsonAutoDetect</code> annotation: it is used to * access default minimum visibility access definitions. */ @JsonAutoDetect( getterVisibility = Visibility.PUBLIC_ONLY, isGetterVisibility = Visibility.PUBLIC_ONLY, setterVisibility = Visibility.ANY, /** * By default, all matching single-arg constructed are found, * regardless of visibility. Does not apply to factory methods, * they can not be auto-detected; ditto for multiple-argument * constructors. */ creatorVisibility = Visibility.ANY, fieldVisibility = Visibility.PUBLIC_ONLY ) public static class Std implements VisibilityChecker<Std>, java.io.Serializable { private static final long serialVersionUID = 1; /** * This is the canonical base instance, configured with default * visibility values */ protected final static Std DEFAULT = new Std(Std.class.getAnnotation(JsonAutoDetect.class)); protected final Visibility _getterMinLevel; protected final Visibility _isGetterMinLevel; protected final Visibility _setterMinLevel; protected final Visibility _creatorMinLevel

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>CreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: default: // break; return this; } } @Override public Std withGetterVisibility(Visibility v) { if (v == Visibility.DEFAULT) v = DEFAULT._getterMinLevel; if (_getterMinLevel == v) return this; return new Std(v, _isGetterMinLevel, _setterMinLevel, _creatorMinLevel, _fieldMinLevel); } @Override public Std withIsGetterVisibility(Visibility v) { if (v == Visibility.DEFAULT) v = DEFAULT._isGetterMinLevel; if (_isGetterMinLevel == v) return this; return new Std(_getterMinLevel, v, _setterMinLevel, _creatorMinLevel, _fieldMinLevel); } @Override public Std withSetterVisibility(Visibility v) { if (v == Visibility.DEFAULT) v = DEFAULT._setterMinLevel; if (_setterMinLevel == v) return this; return new Std(_getterMinLevel, _isGetterMinLevel, v, _creatorMinLevel, _fieldMinLevel); } @Override public Std withCreatorVisibility(Visibility v) { if (v == Visibility.DEFAULT) v = DEFAULT._creatorMinLevel; if (_creatorMinLevel == v) return this; return new Std(_getterMinLevel, _isGetterMinLevel, _setterMinLevel, v, _fieldMinLevel); } @Override public Std withFieldVisibility(Visibility v) { if (v == Visibility.DEFAULT) v = DEFAULT._fieldMinLevel; if (_fieldMinLevel == v) return this; return new Std(_getterMinLevel, _isGetterMinLevel, _setterMinLevel, _creatorMinLevel, v); } /* /******************************************************** /* Public API impl /******************************************************** */ @Override public boolean isCreatorVisible(Member m) { return _creatorMinLevel.isVisible(m); } @Override public boolean isCreatorVisible(AnnotatedMember m) { return isCreatorVisible(m.getMember()); } @Override public boolean isFieldVisible(Field f) { return _fieldMinLevel.isVisible(f); } @Override public boolean isFieldVisible(AnnotatedField f) { return isFieldVisible(f.getAnnotated()); } @Override public boolean isGetterVisible(Method m) { return _getterMinLevel.isVisible(m); } @Override public boolean isGetterVisible(AnnotatedMethod m) { return isGetterVisible(m.getAnnotated()); } @Override public boolean isIsGetterVisible(Method m) { return _isGetterMinLevel.isVisible(m); } @Override public boolean

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /* /********************************************************** /* Methods sub-classes MUST override /********************************************************** */ /** * Method for creating a new {@link ObjectMapper} instance that * has same initial configuration as this instance. Note that this * also requires making a copy of the underlying {@link JsonFactory} * instance. *<p> * Method is typically * used when multiple, differently configured mappers are needed. * Although configuration is shared, cached serializers and deserializers * are NOT shared, which means that the new instance may be re-configured * before use; meaning that it behaves the same way as if an instance * was constructed from scratch. * * @since 2.1 */ public ObjectMapper copy() { _checkInvalidCopy(ObjectMapper.class); return new ObjectMapper(this); } /** * @since 2.1 */ protected void _checkInvalidCopy(Class<?> exp) { if (getClass() != exp) { throw new IllegalStateException("Failed copy(): "+getClass().getName() +" (version: "+version()+") does not override copy(); it has to"); } } /* /********************************************************** /* Methods sub-classes MUST override if providing custom /* ObjectReader/ObjectWriter implementations /********************************************************** */ /** * Factory method sub-classes must override, to produce {@link ObjectReader} * instances of proper sub-type * * @since 2.5 */ protected ObjectReader _newReader(DeserializationConfig config) { return new ObjectReader(this, config); } /** * Factory method sub-classes must override, to produce {@link ObjectReader} * instances of proper sub-type * * @since 2.5 */ protected ObjectReader _newReader(DeserializationConfig config, JavaType valueType, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) { return new ObjectReader(this, config, valueType, valueToUpdate, schema, injectableValues); } /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config) { return new ObjectWriter(this, config); } /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config, FormatSchema schema) { return new ObjectWriter(this, config, schema); } /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config, JavaType rootType, PrettyPrinter pp) { return new ObjectWriter(this, config

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> name '" +expSimpleName+"'), but "+p.getCurrentToken()); } if (p.nextToken() != JsonToken.FIELD_NAME) { throw JsonMappingException.from(p, "Current token not FIELD_NAME (to contain expected root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } String actualName = p.getCurrentName(); if (!expSimpleName.equals(actualName)) { throw JsonMappingException.from(p, "Root name '"+actualName+"' does not match expected ('" +expSimpleName+"') for type "+rootType); } // ok, then move to value itself.... p.nextToken(); Object result = deser.deserialize(p, ctxt); // and last, verify that we now get matching END_OBJECT if (p.nextToken() != JsonToken.END_OBJECT) { throw JsonMappingException.from(p, "Current token not END_OBJECT (to match wrapper object with root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } return result; } /* /********************************************************** /* Internal methods, other /********************************************************** */ /** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = ctxt.findRootValueDeserializer(valueType); if (deser == null) { // can this happen? throw JsonMappingException.from(ctxt, "Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; } /** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_jsonFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_jsonFactory.getFormatName()); } } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.misc; import java.io.IOException; import java.security.Permission; import com.fasterxml.jackson.databind.*; // Test(s) to verify that forced access works as expected public class AccessFixTest extends BaseMapTest { static class CauseBlockingSecurityManager extends SecurityManager { @Override public void checkPermission(Permission perm) throws SecurityException { if ("suppressAccessChecks".equals(perm.getName())) { throw new SecurityException("Can not force permission: "+perm); } } } // [databind#877]: avoid forcing access to `cause` field of `Throwable` // as it is never actually used (always call `initCause()` instead) public void testCauseOfThrowableIgnoral() throws Exception { final SecurityManager origSecMan = System.getSecurityManager(); try { System.setSecurityManager(new CauseBlockingSecurityManager()); _testCauseOfThrowableIgnoral(); } finally { System.setSecurityManager(origSecMan); } } private void _testCauseOfThrowableIgnoral() throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.disable(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); IOException e = mapper.readValue("{}", IOException.class); assertNotNull(e); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.beans.ConstructorProperties; import java.beans.Transient; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.util.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.*; import com.fasterxml.jackson.databind.cfg.HandlerInstantiator; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder; import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; import com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter; import com.fasterxml.jackson.databind.ser.impl.AttributePropertyWriter; import com.fasterxml.jackson.databind.ser.std.RawSerializer; import com.fasterxml.jackson.databind.util.*; /** * {@link AnnotationIntrospector} implementation that handles standard * Jackson annotations. */ public class JacksonAnnotationIntrospector extends AnnotationIntrospector implements java.io.Serializable { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") private final static Class<? extends Annotation>[] ANNOTATIONS_TO_INFER_SER = (Class<? extends Annotation>[]) new Class<?>[] { JsonSerialize.class, JsonView.class, JsonFormat.class, JsonTypeInfo.class, JsonRawValue.class, JsonUnwrapped.class, JsonBackReference.class, JsonManagedReference.class }; @SuppressWarnings("unchecked") private final static Class<? extends Annotation>[] ANNOTATIONS_TO_INFER_DESER = (Class<? extends Annotation>[]) new Class<?>[] { JsonDeserialize.class, JsonView.class, JsonFormat.class, JsonTypeInfo.class, JsonUnwrapped.class, JsonBackReference.class, JsonManagedReference.class }; private static final Java7Support _jdk7Helper; static { Java7Support x = null; try { x = Java7Support.class.newInstance(); } catch (Throwable t) { // 24-Nov-2015, tatu: Should we log or not? java.util.logging.Logger.getLogger(JacksonAnnotationIntrospector.class.getName()) .warning("Unable to load JDK7 annotation types; will have to skip"); } _jdk7Helper = x; } /** * Since introspection of annotation

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /* General annotations /********************************************************** */ /** * Since 2.6, we have supported use of {@link JsonProperty} for specifying * explicit serialized name */ @Override public String findEnumValue(Enum<?> value) { // 11-Jun-2015, tatu: As per [databind#677], need to allow explicit naming. // Unfortunately can not quite use standard AnnotatedClass here (due to various // reasons, including odd representation JVM uses); has to do for now try { // We know that values are actually static fields with matching name so: Field f = value.getClass().getField(value.name()); if (f != null) { JsonProperty prop = f.getAnnotation(JsonProperty.class); if (prop != null) { String n = prop.value(); if (n != null && !n.isEmpty()) { return n; } } } } catch (SecurityException e) { // 17-Sep-2015, tatu: Anything we could/should do here? } catch (NoSuchFieldException e) { // 17-Sep-2015, tatu: should not really happen. But... can we do anything? } return value.name(); } @Override // since 2.7 public String[] findEnumValues(Class<?> enumType, Enum<?>[] enumValues, String[] names) { HashMap<String,String> expl = null; for (Field f : ClassUtil.getDeclaredFields(enumType)) { if (!f.isEnumConstant()) { continue; } JsonProperty prop = f.getAnnotation(JsonProperty.class); if (prop == null) { continue; } String n = prop.value(); if (n.isEmpty()) { continue; } if (expl == null) { expl = new HashMap<String,String>(); } expl.put(f.getName(), n); } // and then stitch them together if and as necessary if (expl != null) { for (int i = 0, end = enumValues.length; i < end; ++i) { String defName = enumValues[i].name(); String explValue = expl.get(defName); if (explValue != null) { names[i] = explValue; } } } return names; } /* /********************************************************** /* General class annotations /********************************************************** */ @Override public PropertyName findRootName(AnnotatedClass ac) { JsonRootName ann = _findAnnotation(ac, JsonRootName.class); if (ann == null) { return null; } String ns = ann.namespace(); if (ns != null && ns.length() == 0) { ns = null; } return

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Object findInjectableValueId(AnnotatedMember m) { JacksonInject ann = _findAnnotation(m, JacksonInject.class); if (ann == null) { return null; } /* Empty String means that we should use name of declared * value class. */ String id = ann.value(); if (id.length() == 0) { // slight complication; for setters, type if (!(m instanceof AnnotatedMethod)) { return m.getRawType().getName(); } AnnotatedMethod am = (AnnotatedMethod) m; if (am.getParameterCount() == 0) { return m.getRawType().getName(); } return am.getRawParameterType(0).getName(); } return id; } @Override public Class<?>[] findViews(Annotated a) { JsonView ann = _findAnnotation(a, JsonView.class); return (ann == null) ? null : ann.value(); } @Override // since 2.7 public AnnotatedMethod resolveSetterConflict(MapperConfig<?> config, AnnotatedMethod setter1, AnnotatedMethod setter2) { Class<?> cls1 = setter1.getRawParameterType(0); Class<?> cls2 = setter2.getRawParameterType(0); // First: prefer primitives over non-primitives // 11-Dec-2015, tatu: TODO, perhaps consider wrappers for primitives too? if (cls1.isPrimitive()) { if (!cls2.isPrimitive()) { return setter1; } } else if (cls2.isPrimitive()) { return setter2; } if (cls1 == String.class) { if (cls2 != String.class) { return setter1; } } else if (cls2 == String.class) { return setter2; } return null; } /* /********************************************************** /* Annotations for Polymorphic Type handling /********************************************************** */ @Override public TypeResolverBuilder<?> findTypeResolver(MapperConfig<?> config, AnnotatedClass ac, JavaType baseType) { return _findTypeResolver(config, ac, baseType); } @Override public TypeResolverBuilder<?> findPropertyTypeResolver(MapperConfig<?> config, AnnotatedMember am, JavaType baseType) { /* As per definition of @JsonTypeInfo, should only apply to contents of container * (collection, map) types, not container types themselves: */ // 17-Apr-2016, tatu: For 2.7.4 make sure ReferenceType also included if (baseType.isContainerType() || baseType.isReferenceType()) { return null; } // No per-member type overrides (yet) return _findTypeResolver(config, am, baseType); } @Override public TypeResolverBuilder<?> findPropertyContentTypeResolver

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>readPropertyValue(JsonParser, BeanProperty, Class)}; * this method does not allow use of contextual annotations. * * @since 2.4 */ public <T> T readValue(JsonParser p, Class<T> type) throws IOException { return readValue(p, getTypeFactory().constructType(type)); } /** * @since 2.4 */ @SuppressWarnings("unchecked") public <T> T readValue(JsonParser p, JavaType type) throws IOException { JsonDeserializer<Object> deser = findRootValueDeserializer(type); if (deser == null) { throw mappingException("Could not find JsonDeserializer for type %s", type); } return (T) deser.deserialize(p, this); } /** * Convenience method that may be used by composite or container deserializers, * for reading one-off values for the composite type, taking into account * annotations that the property (passed to this method -- usually property that * has custom serializer that called this method) has. * * @since 2.4 */ public <T> T readPropertyValue(JsonParser p, BeanProperty prop, Class<T> type) throws IOException { return readPropertyValue(p, prop, getTypeFactory().constructType(type)); } /** * @since 2.4 */ @SuppressWarnings("unchecked") public <T> T readPropertyValue(JsonParser p, BeanProperty prop, JavaType type) throws IOException { JsonDeserializer<Object> deser = findContextualValueDeserializer(type, prop); if (deser == null) { String propName = (prop == null) ? "NULL" : ("'"+prop.getName()+"'"); throw mappingException("Could not find JsonDeserializer for type %s (via property %s)", type, propName); } return (T) deser.deserialize(p, this); } /* /********************************************************** /* Methods for problem handling, reporting /********************************************************** */ /** * Method deserializers can call to inform configured {@link DeserializationProblemHandler}s * of an unrecognized property. * * @return True if there was a configured problem handler that was able to handle the * problem */ public boolean handleUnknownProperty(JsonParser p, JsonDeserializer<?> deser, Object instanceOrClass, String propName) throws IOException, JsonProcessingException { LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); if (h != null) { while (h != null) { // Can bail out if it's handled if (h.value().handleUnknownProperty(this, p, deser, instanceOrClass, propName)) { return true; } h = h.next(); } } return false; } /** * Helper method for reporting a problem with unhandled unknown exception * * @param instanceOrClass Either

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> */ public <T> T reportWrongTokenException(JsonParser p, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { if (msgArgs.length > 0) { msg = String.format(msg, msgArgs); } throw wrongTokenException(p, expToken, msg); } /** * @since 2.8 */ public <T> T reportUnknownTypeException(JavaType type, String id, String extraDesc) throws JsonMappingException { throw unknownTypeException(type, id, extraDesc); } /** * @since 2.8 */ public <T> T reportEndOfInputException(Class<?> instClass) throws JsonMappingException { throw endOfInputException(instClass); } /* /********************************************************** /* Methods for constructing exceptions /********************************************************** */ /** * Helper method for constructing generic mapping exception for specified type */ public JsonMappingException mappingException(Class<?> targetClass) { return mappingException(targetClass, _parser.getCurrentToken()); } public JsonMappingException mappingException(Class<?> targetClass, JsonToken token) { String tokenDesc = (token == null) ? "<end of input>" : String.format("%s token", token); return JsonMappingException.from(_parser, String.format("Can not deserialize instance of %s out of %s", _calcName(targetClass), tokenDesc)); } /** * Helper method for constructing generic mapping exception with specified * message and current location information */ public JsonMappingException mappingException(String message) { return JsonMappingException.from(getParser(), message); } /** * Helper method for constructing generic mapping exception with specified * message and current location information * * @since 2.6 */ public JsonMappingException mappingException(String msgTemplate, Object... args) { String message = String.format(msgTemplate, args); return JsonMappingException.from(getParser(), message); } /** * Helper method for constructing instantiation exception for specified type, * to indicate problem with physically constructing instance of * specified class (missing constructor, exception from constructor) */ public JsonMappingException instantiationException(Class<?> instClass, Throwable t) { return JsonMappingException.from(_parser, String.format("Can not construct instance of %s, problem: %s", instClass.getName(), t.getMessage()), t); } public JsonMappingException instantiationException(Class<?> instClass, String msg) { return JsonMappingException.from(_parser, String.format("Can not construct instance of %s, problem: %s", instClass.getName(), msg)); } /** * Method that will construct an exception suitable for throwing when * some String values are acceptable, but the one encountered is not. * * @param value String value from input being deserialized

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * @param instClass Type that String should be deserialized into * @param msg Message that describes specific problem * * @since 2.1 */ public JsonMappingException weirdStringException(String value, Class<?> instClass, String msg) { return InvalidFormatException.from(_parser, String.format("Can not construct instance of %s from String value (%s): %s", instClass.getName(), _quotedString(value), msg), value, instClass); } /** * Helper method for constructing exception to indicate that input JSON * Number was not suitable for deserializing into given target type. */ public JsonMappingException weirdNumberException(Number value, Class<?> instClass, String msg) { return InvalidFormatException.from(_parser, String.format("Can not construct instance of %s from number value (%s): %s", instClass.getName(), String.valueOf(value), msg), value, instClass); } /** * Helper method for constructing exception to indicate that given JSON * Object field name was not in format to be able to deserialize specified * key type. */ public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue, String msg) { return InvalidFormatException.from(_parser, String.format("Can not construct Map key of type %s from String (%s): %s", keyClass.getName(), _quotedString(keyValue), msg), keyValue, keyClass); } /** * Helper method for indicating that the current token was expected to be another * token. */ public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken, String msg0) { String msg = String.format("Unexpected token (%s), expected %s", p.getCurrentToken(), expToken); if (msg0 != null) { msg = msg + ": "+msg0; } return JsonMappingException.from(p, msg); } /** * Helper method for constructing exception to indicate that given * type id (parsed from JSON) could not be converted to a Java type. */ @Deprecated // since 2.5, use overloaded variant public JsonMappingException unknownTypeException(JavaType type, String id) { return JsonMappingException.from(_parser, "Could not resolve type id '"+id+"' into a subtype of "+type); } /** * @since 2.5 */ public JsonMappingException unknownTypeException(JavaType type, String id, String extraDesc) { String msg = String.format("Could not resolve type id '%s' into a subtype of %s", id, type); if (extraDesc != null) { msg = msg + ": "+extraDesc; } return JsonMappingException.from(_parser, msg); } public JsonMappingException endOfInputException(Class<?> instClass) { return JsonMappingException.from(_parser

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>, "Unexpected end-of-input when trying to deserialize a " +instClass.getName()); } /* /********************************************************** /* Overridable internal methods /********************************************************** */ protected DateFormat getDateFormat() { if (_dateFormat != null) { return _dateFormat; } /* 24-Feb-2012, tatu: At this point, all timezone configuration * should have occurred, with respect to default dateformat * and timezone configuration. But we still better clone * an instance as formatters may be stateful. */ DateFormat df = _config.getDateFormat(); _dateFormat = df = (DateFormat) df.clone(); return df; } protected String determineClassName(Object instance) { return ClassUtil.getClassDescription(instance); } /* /********************************************************** /* Other internal methods /********************************************************** */ protected String _calcName(Class<?> cls) { if (cls.isArray()) { return _calcName(cls.getComponentType())+"[]"; } return cls.getName(); } protected String _valueDesc() { try { return _desc(_parser.getText()); } catch (Exception e) { return "[N/A]"; } } protected String _desc(String desc) { if (desc == null) { return "[N/A]"; } // !!! should we quote it? (in case there are control chars, linefeeds) if (desc.length() > MAX_ERROR_STR_LEN) { desc = desc.substring(0, MAX_ERROR_STR_LEN) + "]...[" + desc.substring(desc.length() - MAX_ERROR_STR_LEN); } return desc; } // @since 2.7 protected String _quotedString(String desc) { if (desc == null) { return "[N/A]"; } // !!! should we quote it? (in case there are control chars, linefeeds) if (desc.length() > MAX_ERROR_STR_LEN) { return String.format("\"%s]...[%s\"", desc.substring(0, MAX_ERROR_STR_LEN), desc.substring(desc.length() - MAX_ERROR_STR_LEN)); } return "\"" + desc + "\""; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> <code>_serializer</code> * is null), we will use a lookup structure for storing dynamically * resolved mapping from type(s) to serializer(s). */ protected transient PropertySerializerMap _dynamicSerializers; /* /********************************************************** /* Filtering /********************************************************** */ /** * Whether null values are to be suppressed (nothing written out if * value is null) or not. Note that this is a configuration value * during construction, and actual handling relies on setting * (or not) of {@link #_nullSerializer}. */ protected final boolean _suppressNulls; /** * Value that is considered default value of the property; used for * default-value-suppression if enabled. */ protected final Object _suppressableValue; /** * Alternate set of property writers used when view-based filtering * is available for the Bean. */ protected final Class<?>[] _includeInViews; /* /********************************************************** /* Opaque internal data that bean serializer factory and /* bean serializers can add. /********************************************************** */ protected transient HashMap<Object,Object> _internalSettings; /* /********************************************************** /* Construction, configuration /********************************************************** */ @SuppressWarnings("unchecked") public BeanPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, Object suppressableValue) { super(propDef); _member = member; _contextAnnotations = contextAnnotations; _name = new SerializedString(propDef.getName()); _wrapperName = propDef.getWrapperName(); _includeInViews = propDef.findViews(); _declaredType = declaredType; _serializer = (JsonSerializer<Object>) ser; _dynamicSerializers = (ser == null) ? PropertySerializerMap.emptyForProperties() : null; _typeSerializer = typeSer; _cfgSerializationType = serType; if (member instanceof AnnotatedField) { _accessorMethod = null; _field = (Field) member.getMember(); } else if (member instanceof AnnotatedMethod) { _accessorMethod = (Method) member.getMember(); _field = null; } else { // 01-Dec-2014, tatu: Used to be illegal, but now explicitly allowed for virtual props _accessorMethod = null; _field = null; } _suppressNulls = suppressNulls; _suppressableValue = suppressableValue; // this will be resolved later on, unless nulls are to be suppressed _nullSerializer = null; } /** * Constructor that may be of use to virtual properties, when there is need for * the zero-arg ("default") constructor, and actual initialization is done * after constructor call. *

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>SerializationType = base._cfgSerializationType; _dynamicSerializers = base._dynamicSerializers; _suppressNulls = base._suppressNulls; _suppressableValue = base._suppressableValue; _includeInViews = base._includeInViews; _typeSerializer = base._typeSerializer; _nonTrivialBaseType = base._nonTrivialBaseType; } public BeanPropertyWriter rename(NameTransformer transformer) { String newName = transformer.transform(_name.getValue()); if (newName.equals(_name.toString())) { return this; } return _new(PropertyName.construct(newName)); } /** * Overridable factory method used by sub-classes * * @since 2.6.0 */ protected BeanPropertyWriter _new(PropertyName newName) { return new BeanPropertyWriter(this, newName); } /** * Method called to set, reset or clear the configured type serializer * for property. * * @since 2.6 */ public void assignTypeSerializer(TypeSerializer typeSer) { _typeSerializer = typeSer; } /** * Method called to assign value serializer for property * * @since 2.0 */ public void assignSerializer(JsonSerializer<Object> ser) { // may need to disable check in future? if (_serializer != null && _serializer != ser) { throw new IllegalStateException("Can not override serializer"); } _serializer = ser; } /** * Method called to assign null value serializer for property * * @since 2.0 */ public void assignNullSerializer(JsonSerializer<Object> nullSer) { // may need to disable check in future? if (_nullSerializer != null && _nullSerializer != nullSer) { throw new IllegalStateException("Can not override null serializer"); } _nullSerializer = nullSer; } /** * Method called create an instance that handles details of unwrapping * contained value. */ public BeanPropertyWriter unwrappingWriter(NameTransformer unwrapper) { return new UnwrappingBeanPropertyWriter(this, unwrapper); } /** * Method called to define type to consider as "non-trivial" basetype, * needed for dynamic serialization resolution for complex (usually container) * types */ public void setNonTrivialBaseType(JavaType t) { _nonTrivialBaseType = t; } /* /********************************************************** /* JDK Serializability /********************************************************** */ /* Ideally would not require mutable state, and instead would re-create with * final settings. However, as things are, with sub-types and all, simplest * to just change Field/Method value directly. */ Object readResolve() { if (_member instanceof AnnotatedField) { _accessorMethod = null; _field = (Field) _member.getMember(); } else if (_member instanceof

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> AnnotatedMethod) { _accessorMethod = (Method) _member.getMember(); _field = null; } if (_serializer == null) { _dynamicSerializers = PropertySerializerMap.emptyForProperties(); } return this; } /* /********************************************************** /* BeanProperty impl /********************************************************** */ // Note: also part of 'PropertyWriter' @Override public String getName() { return _name.getValue(); } // Note: also part of 'PropertyWriter' @Override public PropertyName getFullName() { // !!! TODO: impl properly return new PropertyName(_name.getValue()); } @Override public JavaType getType() { return _declaredType; } @Override public PropertyName getWrapperName() { return _wrapperName; } // Note: also part of 'PropertyWriter' @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return (_member == null) ? null : _member.getAnnotation(acls); } // Note: also part of 'PropertyWriter' @Override public <A extends Annotation> A getContextAnnotation(Class<A> acls) { return (_contextAnnotations == null) ? null : _contextAnnotations.get(acls); } @Override public AnnotatedMember getMember() { return _member; } // @since 2.3 -- needed so it can be overridden by unwrapping writer protected void _depositSchemaProperty(ObjectNode propertiesNode, JsonNode schemaNode) { propertiesNode.set(getName(), schemaNode); } /* /********************************************************** /* Managing and accessing of opaque internal settings /* (used by extensions) /********************************************************** */ /** * Method for accessing value of specified internal setting. * * @return Value of the setting, if any; null if none. */ public Object getInternalSetting(Object key) { return (_internalSettings == null) ? null : _internalSettings.get(key); } /** * Method for setting specific internal setting to given value * * @return Old value of the setting, if any (null if none) */ public Object setInternalSetting(Object key, Object value) { if (_internalSettings == null) { _internalSettings = new HashMap<Object,Object>(); } return _internalSettings.put(key, value); } /** * Method for removing entry for specified internal setting. * * @return Existing value of the setting, if any (null if none) */ public Object removeInternalSetting(Object key) { Object removed = null; if (_internalSettings != null) { removed = _internalSettings.remove(key); // to reduce memory usage, let's also drop the Map itself, if empty if (_internalSettings.size() == 0) { _internalSettings = null; } } return removed; } /*

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /********************************************************** /* Accessors /********************************************************** */ public SerializableString getSerializedName() { return _name; } public boolean hasSerializer() { return _serializer != null; } public boolean hasNullSerializer() { return _nullSerializer != null; } /** * @since 2.6 */ public TypeSerializer getTypeSerializer() { return _typeSerializer; } /** * Accessor that will return true if this bean property has to support * "unwrapping"; ability to replace POJO structural wrapping with optional * name prefix and/or suffix (or in some cases, just removal of wrapper name). *<p> * Default implementation simply returns false. * * @since 2.3 */ public boolean isUnwrapping() { return false; } public boolean willSuppressNulls() { return _suppressNulls; } /** * Method called to check to see if this property has a name that would * conflict with a given name. * * @since 2.6 */ public boolean wouldConflictWithName(PropertyName name) { if (_wrapperName != null) { return _wrapperName.equals(name); } // Bit convoluted since our support for namespaces is spotty but: return name.hasSimpleName(_name.getValue()) && !name.hasNamespace(); } // Needed by BeanSerializer#getSchema public JsonSerializer<Object> getSerializer() { return _serializer; } public JavaType getSerializationType() { return _cfgSerializationType; } public Class<?> getRawSerializationType() { return (_cfgSerializationType == null) ? null : _cfgSerializationType.getRawClass(); } /* public JavaType getFullPropertyType() { if (_accessorMethod != null) { return _accessorMethod.getType() } if (_field != null) { return _field.getType(); } return null; } */ /** * @deprecated Since 2.7, to be removed from 2.8, use {@link #getType()} instead. */ @Deprecated public Class<?> getPropertyType() { if (_accessorMethod != null) { return _accessorMethod.getReturnType(); } if (_field != null) { return _field.getType(); } return null; } /** * Get the generic property type of this property writer. * * @return The property type, or null if not found. * * @deprecated Since 2.7, to be removed from 2.8, use {@link #getType()} instead. */ @Deprecated public Type getGenericPropertyType() { if (_accessorMethod != null) { return _accessorMethod.getGenericReturnType(); } if (_field != null) { return _field.getGenericType(); } return null; } public Class<?>[] getViews() { return _includeInViews; } /* /**********************************************************

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /* PropertyWriter methods (serialization) /********************************************************** */ /** * Method called to access property that this bean stands for, from * within given bean, and to serialize it as a JSON Object field * using appropriate serializer. */ @Override public void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // inlined 'get()' final Object value = (_accessorMethod == null) ? _field.get(bean) : _accessorMethod.invoke(bean); // Null handling is bit different, check that first if (value == null) { if (_nullSerializer != null) { gen.writeFieldName(_name); _nullSerializer.serialize(null, gen, prov); } return; } // then find serializer to use JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap m = _dynamicSerializers; ser = m.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(m, cls, prov); } } // and then see if we must suppress certain values (default, empty) if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { return; } } else if (_suppressableValue.equals(value)) { return; } } // For non-nulls: simple check for direct cycles if (value == bean) { // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } gen.writeFieldName(_name); if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } } /** * Method called to indicate that serialization of a field was omitted * due to filtering, in cases where backend data format does not allow * basic omission. * * @since 2.3 */ @Override public void serializeAsOmittedField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (!gen.canOmitFields()) { gen.writeOmittedField(_name.getValue()); } } /** * Alternative to {@link #serializeAsField} that is used when a POJO * is serialized as JSON Array; the difference is that no field names * are written. * * @since 2.3 */ @Override public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // inlined 'get()' final Object value = (_accessorMethod == null) ? _field.get(

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>bean) : _accessorMethod.invoke(bean); if (value == null) { // nulls need specialized handling if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else { // can NOT suppress entries in tabular output gen.writeNull(); } return; } // otherwise find serializer to use JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } // and then see if we must suppress certain values (default, empty) if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { // can NOT suppress entries in tabular output serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { // can NOT suppress entries in tabular output serializeAsPlaceholder(bean, gen, prov); return; } } // For non-nulls: simple check for direct cycles if (value == bean) { if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } } /** * Method called to serialize a placeholder used in tabular output when * real value is not to be included (is filtered out), but when we need * an entry so that field indexes will not be off. Typically this should * output null or empty String, depending on datatype. * * @since 2.1 */ @Override public void serializeAsPlaceholder(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else { gen.writeNull(); } } /* /********************************************************** /* PropertyWriter methods (schema generation) /********************************************************** */ // Also part of BeanProperty implementation @Override public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializerProvider provider) throws JsonMappingException { if (v != null) { if (isRequired()) { v.property(this); } else { v.optionalProperty(this); } } } // // // Legacy support for JsonFormatVisitable /** * Attempt to add the output of the given {@link BeanPropertyWriter} in the given {@link ObjectNode}. * Otherwise, add the default schema {@link JsonNode} in place of the

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>ENCES} is enabled; * or return <code>false</code> if it is disabled. * * @return True if method fully handled self-referential value; false if not (caller * is to handle it) or {@link JsonMappingException} if there is no way handle it */ protected boolean _handleSelfReference(Object bean, JsonGenerator gen, SerializerProvider prov, JsonSerializer<?> ser) throws JsonMappingException { if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES) && !ser.usesObjectId()) { // 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling // object id; this may be the case for BeanSerializers at least. // 13-Feb-2014, tatu: another possible ok case: custom serializer (something // OTHER than {@link BeanSerializerBase} if (ser instanceof BeanSerializerBase) { throw JsonMappingException.from(gen, "Direct self-reference leading to cycle"); } } return false; } @Override public String toString() { StringBuilder sb = new StringBuilder(40); sb.append("property '").append(getName()).append("' ("); if (_accessorMethod != null) { sb.append("via method ").append(_accessorMethod.getDeclaringClass().getName()).append("#").append(_accessorMethod.getName()); } else if (_field != null) { sb.append("field \"").append(_field.getDeclaringClass().getName()).append("#").append(_field.getName()); } else { sb.append("virtual"); } if (_serializer == null) { sb.append(", no static serializer"); } else { sb.append(", static serializer of type "+_serializer.getClass().getName()); } sb.append(')'); return sb.toString(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.HashSet; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; /** * Container class for deserializers that handle core JDK primitive * (and matching wrapper) types, as well as standard "big" numeric types. * Note that this includes types such as {@link java.lang.Boolean} * and {@link java.lang.Character} which are not strictly numeric, * but are part of primitive/wrapper types. */ public class NumberDeserializers { private final static HashSet<String> _classNames = new HashSet<String>(); static { // note: can skip primitive types; other ways to check them: Class<?>[] numberTypes = new Class<?>[] { Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Long.class, Float.class, Double.class, // and more generic ones Number.class, BigDecimal.class, BigInteger.class }; for (Class<?> cls : numberTypes) { _classNames.add(cls.getName()); } } public static JsonDeserializer<?> find(Class<?> rawType, String clsName) { if (rawType.isPrimitive()) { if (rawType == Integer.TYPE) { return IntegerDeserializer.primitiveInstance; } if (rawType == Boolean.TYPE) { return BooleanDeserializer.primitiveInstance; } if (rawType == Long.TYPE) { return LongDeserializer.primitiveInstance; } if (rawType == Double.TYPE) { return DoubleDeserializer.primitiveInstance; } if (rawType == Character.TYPE) { return CharacterDeserializer.primitiveInstance; } if (rawType == Byte.TYPE) { return ByteDeserializer.primitiveInstance; } if (rawType == Short.TYPE) { return ShortDeserializer.primitiveInstance; } if (rawType == Float.TYPE) { return FloatDeserializer.primitiveInstance; } } else if (_classNames.contains(clsName)) { // Start with most common types; int, boolean, long, double if (rawType == Integer.class) { return IntegerDeserializer.wrapperInstance; } if (rawType == Boolean.class) { return BooleanDeserializer.wrapperInstance; } if (rawType == Long.class) { return LongDeserializer.wrapperInstance; } if (rawType == Double.class) { return DoubleDeserializer.wrapperInstance; } if (rawType == Character.class) { return CharacterDeserializer.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>wrapperInstance; } if (rawType == Byte.class) { return ByteDeserializer.wrapperInstance; } if (rawType == Short.class) { return ShortDeserializer.wrapperInstance; } if (rawType == Float.class) { return FloatDeserializer.wrapperInstance; } if (rawType == Number.class) { return NumberDeserializer.instance; } if (rawType == BigDecimal.class) { return BigDecimalDeserializer.instance; } if (rawType == BigInteger.class) { return BigIntegerDeserializer.instance; } } else { return null; } // should never occur throw new IllegalArgumentException("Internal error: can't find deserializer for "+rawType.getName()); } /* /********************************************************** /* Then one intermediate base class for things that have /* both primitive and wrapper types /********************************************************** */ protected abstract static class PrimitiveOrWrapperDeserializer<T> extends StdScalarDeserializer<T> { private static final long serialVersionUID = 1L; protected final T _nullValue; protected final boolean _primitive; protected PrimitiveOrWrapperDeserializer(Class<T> vc, T nvl) { super(vc); _nullValue = nvl; _primitive = vc.isPrimitive(); } @Override public final T getNullValue(DeserializationContext ctxt) throws JsonMappingException { if (_primitive && ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) { throw ctxt.mappingException( "Can not map JSON null into type %s (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)", handledType().toString()); } return _nullValue; } @Override @Deprecated // remove in 2.7 public final T getNullValue() { return _nullValue; } @Override public T getEmptyValue(DeserializationContext ctxt) throws JsonMappingException { // [databind#1095]: Should not allow coercion from into null from Empty String // either, if `null` not allowed if (_primitive && ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) { throw ctxt.mappingException( "Can not map Empty String as null into type %s (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)", handledType().toString()); } return _nullValue; } } /* /********************************************************** /* Then primitive/wrapper types /********************************************************** */ @JacksonStdImpl public final static class BooleanDeserializer extends PrimitiveOrWrapperDeserializer<Boolean> { private static final long serialVersionUID = 1L; final static BooleanDeserializer primitiveInstance = new BooleanDeserializer(Boolean.TYPE, Boolean.FALSE); final static BooleanDeserializer wrapperInstance

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> if (text.length() == 1) { return Character.valueOf(text.charAt(0)); } // actually, empty should become null? if (text.length() == 0) { return (Character) getEmptyValue(ctxt); } break; case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Character C = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array" ); } return C; } } throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } } @JacksonStdImpl public final static class IntegerDeserializer extends PrimitiveOrWrapperDeserializer<Integer> { private static final long serialVersionUID = 1L; final static IntegerDeserializer primitiveInstance = new IntegerDeserializer(Integer.TYPE, Integer.valueOf(0)); final static IntegerDeserializer wrapperInstance = new IntegerDeserializer(Integer.class, null); public IntegerDeserializer(Class<Integer> cls, Integer nvl) { super(cls, nvl); } // since 2.6, slightly faster lookups for this very common type @Override public boolean isCachable() { return true; } @Override public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getIntValue(); } return _parseInteger(p, ctxt); } // Since we can never have type info ("natural type"; String, Boolean, Integer, Double): // (is it an error to even call this version?) @Override public Integer deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getIntValue(); } return _parseInteger(p, ctxt); } } @JacksonStdImpl public final static class LongDeserializer extends PrimitiveOrWrapperDeserializer<Long> { private static final long serialVersionUID = 1L; final static LongDeserializer primitiveInstance = new LongDeserializer(Long.TYPE, Long.valueOf(0L)); final static LongDeserializer wrapperInstance = new LongDeserializer(Long.class, null); public LongDeserializer(Class<Long> cls, Long nvl) { super(cls, nvl); } // since 2.6, slightly faster lookups for this very common type @Override public boolean isCachable() { return true; } @Override public

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Value(); case JsonTokenId.ID_NUMBER_FLOAT: if (ctxt.isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)) { return p.getDecimalValue(); } return Double.valueOf(p.getDoubleValue()); case JsonTokenId.ID_STRING: /* Textual values are more difficult... not parsing itself, but figuring * out 'minimal' type to use */ String text = p.getText().trim(); if (text.length() == 0) { return getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return getNullValue(ctxt); } if (_isPosInf(text)) { return Double.POSITIVE_INFINITY; } if (_isNegInf(text)) { return Double.NEGATIVE_INFINITY; } if (_isNaN(text)) { return Double.NaN; } try { if (!_isIntNumber(text)) { if (ctxt.isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)) { return new BigDecimal(text); } return new Double(text); } if (ctxt.isEnabled(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS)) { return new BigInteger(text); } long value = Long.parseLong(text); if (!ctxt.isEnabled(DeserializationFeature.USE_LONG_FOR_INTS)) { if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) { return Integer.valueOf((int) value); } } return Long.valueOf(value); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid number"); } case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Object value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array" ); } return value; } break; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } /** * As mentioned in class Javadoc, there is additional complexity in * handling potentially mixed type information here. Because of this, * we must actually check for "raw" integers and doubles first, before * calling type deserializer. */ @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { switch (jp.getCurrentTokenId()) { case JsonTokenId

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * (not factory) and there is no configurability, this * factory is stateless. * This means that a global singleton instance can be used. */ public class BeanSerializerFactory extends BasicSerializerFactory implements java.io.Serializable // since 2.1 { private static final long serialVersionUID = 1; /** * Like {@link BasicSerializerFactory}, this factory is stateless, and * thus a single shared global (== singleton) instance can be used * without thread-safety issues. */ public final static BeanSerializerFactory instance = new BeanSerializerFactory(null); /* /********************************************************** /* Life-cycle: creation, configuration /********************************************************** */ /** * Constructor for creating instances with specified configuration. */ protected BeanSerializerFactory(SerializerFactoryConfig config) { super(config); } /** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional serializers, or losing serializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); } @Override protected Iterable<Serializers> customSerializers() { return _factoryConfig.serializers(); } /* /********************************************************** /* SerializerFactory impl /********************************************************** */ /** * Main serializer constructor method. We will have to be careful * with respect to ordering of various method calls: essentially * we want to reliably figure out which classes are standard types, * and which are beans. The problem is that some bean Classes may * implement standard interfaces (say, {@link java.lang.Iterable}. *<p> * Note: sub-classes may choose to complete replace implementation, * if they want to alter priority of serializer lookups. */ @Override @SuppressWarnings("unchecked") public JsonSerializer<Object> createSerializer(SerializerProvider prov, JavaType origType) throws JsonMappingException { // Very first thing, let's check if there is explicit serializer annotation: final SerializationConfig config = prov.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.serializerModifiers()) { props = mod.orderProperties(config, beanDesc, props); } } /* And if Object Id is needed, some preparation for that as well: better * do before view handling, mostly for the custom id case which needs * access to a property */ builder.setObjectIdWriter(constructObjectIdHandler(prov, beanDesc, props)); builder.setProperties(props); builder.setFilterId(findFilterId(config, beanDesc)); AnnotatedMember anyGetter = beanDesc.findAnyGetter(); if (anyGetter != null) { if (config.canOverrideAccessModifiers()) { anyGetter.fixAccess(config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } JavaType type = anyGetter.getType(); // copied from BasicSerializerFactory.buildMapSerializer(): boolean staticTyping = config.isEnabled(MapperFeature.USE_STATIC_TYPING); JavaType valueType = type.getContentType(); TypeSerializer typeSer = createTypeSerializer(config, valueType); // last 2 nulls; don't know key, value serializers (yet) // 23-Feb-2015, tatu: As per [#705], need to support custom serializers JsonSerializer<?> anySer = findSerializerFromAnnotation(prov, anyGetter); if (anySer == null) { // TODO: support '@JsonIgnoreProperties' with any setter? anySer = MapSerializer.construct(/* ignored props*/ null, type, staticTyping, typeSer, null, null, /*filterId*/ null); } // TODO: can we find full PropertyName? PropertyName name = PropertyName.construct(anyGetter.getName()); BeanProperty.Std anyProp = new BeanProperty.Std(name, valueType, null, beanDesc.getClassAnnotations(), anyGetter, PropertyMetadata.STD_OPTIONAL); builder.setAnyGetter(new AnyGetterWriter(anyProp, anyGetter, anySer)); } // Next: need to gather view information, if any: processViews(config, builder); // Finally: let interested parties mess with the result bit more... if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { builder = mod.updateBuilder(config, beanDesc, builder); } } JsonSerializer<Object> ser = (JsonSerializer<Object>) builder.build(); if (ser == null) { // If we get this far, there were no properties found, so no regular BeanSerializer // would be constructed. But, couple of exceptions. // First: if there are known annotations, just create 'empty bean' serializer if (beanDesc.hasKnownClassAnnotations()) { return builder.createDummy(); } } return ser; } protected ObjectIdWriter constructObjectIdHandler(SerializerProvider prov, BeanDescription beanDesc, List<BeanPropertyWriter>

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> props) throws JsonMappingException { ObjectIdInfo objectIdInfo = beanDesc.getObjectIdInfo(); if (objectIdInfo == null) { return null; } ObjectIdGenerator<?> gen; Class<?> implClass = objectIdInfo.getGeneratorType(); // Just one special case: Property-based generator is trickier if (implClass == ObjectIdGenerators.PropertyGenerator.class) { // most special one, needs extra work String propName = objectIdInfo.getPropertyName().getSimpleName(); BeanPropertyWriter idProp = null; for (int i = 0, len = props.size() ;; ++i) { if (i == len) { throw new IllegalArgumentException("Invalid Object Id definition for "+beanDesc.getBeanClass().getName() +": can not find property with name '"+propName+"'"); } BeanPropertyWriter prop = props.get(i); if (propName.equals(prop.getName())) { idProp = prop; /* Let's force it to be the first property to output * (although it may still get rearranged etc) */ if (i > 0) { props.remove(i); props.add(0, idProp); } break; } } JavaType idType = idProp.getType(); gen = new PropertyBasedObjectIdGenerator(objectIdInfo, idProp); // one more thing: must ensure that ObjectIdWriter does not actually write the value: return ObjectIdWriter.construct(idType, (PropertyName) null, gen, objectIdInfo.getAlwaysAsId()); } // other types are simpler JavaType type = prov.constructType(implClass); // Could require type to be passed explicitly, but we should be able to find it too: JavaType idType = prov.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0]; gen = prov.objectIdGeneratorInstance(beanDesc.getClassInfo(), objectIdInfo); return ObjectIdWriter.construct(idType, objectIdInfo.getPropertyName(), gen, objectIdInfo.getAlwaysAsId()); } /** * Method called to construct a filtered writer, for given view * definitions. Default implementation constructs filter that checks * active view type to views property is to be included in. */ protected BeanPropertyWriter constructFilteredBeanWriter(BeanPropertyWriter writer, Class<?>[] inViews) { return FilteredBeanPropertyWriter.constructViewBased(writer, inViews); } protected PropertyBuilder constructPropertyBuilder(SerializationConfig config, BeanDescription beanDesc) { return new PropertyBuilder(config, beanDesc); } protected BeanSerializerBuilder constructBeanSerializerBuilder(BeanDescription beanDesc) { return new BeanSerializerBuilder(beanDesc); } /* /********************************************************** /* Overridable non-public introspection methods /********************************************************** */ /** * Helper method used to skip processing for types that we know

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * can not be (i.e. are never consider to be) beans: * things like primitives, Arrays, Enums, and proxy types. *<p> * Note that usually we shouldn't really be getting these sort of * types anyway; but better safe than sorry. */ protected boolean isPotentialBeanType(Class<?> type) { return (ClassUtil.canBeABeanType(type) == null) && !ClassUtil.isProxyType(type); } /** * Method used to collect all actual serializable properties. * Can be overridden to implement custom detection schemes. */ protected List<BeanPropertyWriter> findBeanProperties(SerializerProvider prov, BeanDescription beanDesc, BeanSerializerBuilder builder) throws JsonMappingException { List<BeanPropertyDefinition> properties = beanDesc.findProperties(); final SerializationConfig config = prov.getConfig(); // [JACKSON-429]: ignore specified types removeIgnorableTypes(config, beanDesc, properties); // and possibly remove ones without matching mutator... if (config.isEnabled(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS)) { removeSetterlessGetters(config, beanDesc, properties); } // nothing? can't proceed (caller may or may not throw an exception) if (properties.isEmpty()) { return null; } // null is for value type serializer, which we don't have access to from here (ditto for bean prop) boolean staticTyping = usesStaticTyping(config, beanDesc, null); PropertyBuilder pb = constructPropertyBuilder(config, beanDesc); ArrayList<BeanPropertyWriter> result = new ArrayList<BeanPropertyWriter>(properties.size()); final boolean fixAccess = config.canOverrideAccessModifiers(); final boolean forceAccess = fixAccess && config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); for (BeanPropertyDefinition property : properties) { final AnnotatedMember accessor = property.getAccessor(); // Type id? Requires special handling: if (property.isTypeId()) { if (accessor != null) { // only add if we can access... but otherwise? if (fixAccess) { accessor.fixAccess(forceAccess); } builder.setTypeId(accessor); } continue; } // suppress writing of back references AnnotationIntrospector.ReferenceProperty refType = property.findReferenceType(); if (refType != null && refType.isBackReference()) { continue; } if (accessor instanceof AnnotatedMethod) { result.add(_constructWriter(prov, property, pb, staticTyping, (AnnotatedMethod) accessor)); } else { result.add(_constructWriter(prov, property, pb, staticTyping, (AnnotatedField) accessor)); } } return result; } /* /********************************************************** /* Overridable non-public methods for manipulating bean properties

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /********************************************************** */ /** * Overridable method that can filter out properties. Default implementation * checks annotations class may have. */ protected List<BeanPropertyWriter> filterBeanProperties(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyWriter> props) { AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String[] ignored = intr.findPropertiesToIgnore(ac, true); if (ignored != null && ignored.length > 0) { HashSet<String> ignoredSet = ArrayBuilders.arrayToSet(ignored); Iterator<BeanPropertyWriter> it = props.iterator(); while (it.hasNext()) { if (ignoredSet.contains(it.next().getName())) { it.remove(); } } } return props; } /** * Method called to handle view information for constructed serializer, * based on bean property writers. *<p> * Note that this method is designed to be overridden by sub-classes * if they want to provide custom view handling. As such it is not * considered an internal implementation detail, and will be supported * as part of API going forward. */ protected void processViews(SerializationConfig config, BeanSerializerBuilder builder) { // [JACKSON-232]: whether non-annotated fields are included by default or not is configurable List<BeanPropertyWriter> props = builder.getProperties(); boolean includeByDefault = config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION); final int propCount = props.size(); int viewsFound = 0; BeanPropertyWriter[] filtered = new BeanPropertyWriter[propCount]; // Simple: view information is stored within individual writers, need to combine: for (int i = 0; i < propCount; ++i) { BeanPropertyWriter bpw = props.get(i); Class<?>[] views = bpw.getViews(); if (views == null) { // no view info? include or exclude by default? if (includeByDefault) { filtered[i] = bpw; } } else { ++viewsFound; filtered[i] = constructFilteredBeanWriter(bpw, views); } } // minor optimization: if no view info, include-by-default, can leave out filtering info altogether: if (includeByDefault && viewsFound == 0) { return; } builder.setFilteredProperties(filtered); } /** * Method that will apply by-type limitations (as per [JACKSON-429]); * by default this is based on {@link com.fasterxml.jackson.annotation.JsonIgnoreType} * annotation but can be supplied by module-provided introspectors too. */ protected void removeIgnorableTypes(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyDefinition> properties

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> class, if it has one. */ protected AnnotatedConstructor _defaultConstructor; /** * Single argument constructors the class has, if any. */ protected List<AnnotatedConstructor> _constructors; /** * Single argument static methods that might be usable * as factory methods */ protected List<AnnotatedMethod> _creatorMethods; /** * Member methods of interest; for now ones with 0 or 1 arguments * (just optimization, since others won't be used now) */ protected AnnotatedMethodMap _memberMethods; /** * Member fields of interest: ones that are either public, * or have at least one annotation. */ protected List<AnnotatedField> _fields; /* /********************************************************** /* Life-cycle /********************************************************** */ /** * Constructor will not do any initializations, to allow for * configuring instances differently depending on use cases */ private AnnotatedClass(JavaType type, Class<?> rawType, TypeBindings bindings, List<JavaType> superTypes, AnnotationIntrospector aintr, MixInResolver mir, TypeFactory tf, AnnotationMap classAnnotations) { _type = type; _class = rawType; _bindings = bindings; _superTypes = superTypes; _annotationIntrospector = aintr; _typeFactory = tf; _mixInResolver = mir; _primaryMixIn = (_mixInResolver == null) ? null : _mixInResolver.findMixInClassFor(_class); _classAnnotations = classAnnotations; } @Override public AnnotatedClass withAnnotations(AnnotationMap ann) { return new AnnotatedClass(_type, _class, _bindings, _superTypes, _annotationIntrospector, _mixInResolver, _typeFactory, ann); } /** * Factory method that instantiates an instance. Returned instance * will only be initialized with class annotations, but not with * any method information. * * @since 2.7 */ public static AnnotatedClass construct(JavaType type, MapperConfig<?> config) { AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null; Class<?> raw = type.getRawClass(); return new AnnotatedClass(type, raw, type.getBindings(), ClassUtil.findSuperTypes(type, null, false), intr, (MixInResolver) config, config.getTypeFactory(), null); } /** * @since 2.7 */ public static AnnotatedClass construct(JavaType type, MapperConfig<?> config, MixInResolver mir) { AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null; Class<?> raw = type.getRawClass(); return new AnnotatedClass(type, raw, type.getBindings(), ClassUtil.findSuperTypes(type

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>, null, false), intr, mir, config.getTypeFactory(), null); } /** * Method similar to {@link #construct}, but that will NOT include * information from supertypes; only class itself and any direct * mix-ins it may have. */ public static AnnotatedClass constructWithoutSuperTypes(Class<?> cls, MapperConfig<?> config) { if (config == null) { return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(), Collections.<JavaType>emptyList(), null, null, null, null); } AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null; return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(), Collections.<JavaType>emptyList(), intr, (MixInResolver) config, config.getTypeFactory(), null); } public static AnnotatedClass constructWithoutSuperTypes(Class<?> cls, MapperConfig<?> config, MixInResolver mir) { if (config == null) { return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(), Collections.<JavaType>emptyList(), null, null, null, null); } AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null; return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(), Collections.<JavaType>emptyList(), intr, mir, config.getTypeFactory(), null); } /* /********************************************************** /* TypeResolutionContext implementation /********************************************************** */ @Override public JavaType resolveType(Type type) { return _typeFactory.constructType(type, _bindings); } /* /********************************************************** /* Annotated impl /********************************************************** */ @Override public Class<?> getAnnotated() { return _class; } @Override public int getModifiers() { return _class.getModifiers(); } @Override public String getName() { return _class.getName(); } @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return _classAnnotations().get(acls); } @Override public boolean hasAnnotation(Class<?> acls) { return _classAnnotations().has(acls); } @Override public boolean hasOneOf(Class<? extends Annotation>[] annoClasses) { return _classAnnotations().hasOneOf(annoClasses); } @Override public Class<?> getRawType() { return _class; } @Override public Iterable<Annotation> annotations() { return _classAnnotations().annotations(); } @Override protected AnnotationMap getAllAnnotations() { return _classAnnotations(); } @Override public JavaType getType() { return _type; } /* /********************************************************** /* Public API, generic accessors /********************************************************** */ public Annotations getAnnotations() { return

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> _classAnnotations(); } public boolean hasAnnotations() { return _classAnnotations().size() > 0; } public AnnotatedConstructor getDefaultConstructor() { if (!_creatorsResolved) { resolveCreators(); } return _defaultConstructor; } public List<AnnotatedConstructor> getConstructors() { if (!_creatorsResolved) { resolveCreators(); } return _constructors; } public List<AnnotatedMethod> getStaticMethods() { if (!_creatorsResolved) { resolveCreators(); } return _creatorMethods; } public Iterable<AnnotatedMethod> memberMethods() { if (_memberMethods == null) { resolveMemberMethods(); } return _memberMethods; } public int getMemberMethodCount() { if (_memberMethods == null) { resolveMemberMethods(); } return _memberMethods.size(); } public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes) { if (_memberMethods == null) { resolveMemberMethods(); } return _memberMethods.find(name, paramTypes); } public int getFieldCount() { if (_fields == null) { resolveFields(); } return _fields.size(); } public Iterable<AnnotatedField> fields() { if (_fields == null) { resolveFields(); } return _fields; } /* /********************************************************** /* Public API, main-level resolution methods /********************************************************** */ private AnnotationMap _classAnnotations() { AnnotationMap anns = _classAnnotations; if (anns == null) { // 06-Dec-2015, tatu: yes, double-locking, typically not a good choice. // But for typical usage pattern here (and with JVM 7 and above) is // a reasonable choice to avoid non-common but existing race condition // from root name lookup style usage // Also note that race condition stems from caching only used for loading // where just class annotations are needed synchronized (this) { anns = _classAnnotations; if (anns == null) { anns = _resolveClassAnnotations(); _classAnnotations = anns; } } } return anns; } /** * Initialization method that will recursively collect Jackson * annotations for this class and all super classes and * interfaces. */ private AnnotationMap _resolveClassAnnotations() { AnnotationMap ca = new AnnotationMap(); // Should skip processing if annotation processing disabled if (_annotationIntrospector != null) { // add mix-in annotations first (overrides) if (_primaryMixIn != null) { _addClassMixIns(ca, _class, _primaryMixIn); } // first, annotations from the class itself: _addAnnotationsIfNotPresent(ca, ClassUtil.findClassAnnotations(_

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>alas, Object#getClass can NOT be * exposed) */ // 14-Feb-2011, tatu: AnnotationIntrospector is null if annotations not enabled; if so, can skip: if (_annotationIntrospector != null) { if (!mixins.isEmpty()) { Iterator<AnnotatedMethod> it = mixins.iterator(); while (it.hasNext()) { AnnotatedMethod mixIn = it.next(); try { Method m = Object.class.getDeclaredMethod(mixIn.getName(), mixIn.getRawParameterTypes()); if (m != null) { // Since it's from java.lang.Object, no generics, no need for real type context: AnnotatedMethod am = _constructMethod(m, this); _addMixOvers(mixIn.getAnnotated(), am, false); _memberMethods.add(am); } } catch (Exception e) { } } } } } /** * Method that will collect all member (non-static) fields * that are either public, or have at least a single annotation * associated with them. */ private void resolveFields() { Map<String,AnnotatedField> foundFields = _findFields(_type, this, null); if (foundFields == null || foundFields.size() == 0) { _fields = Collections.emptyList(); } else { _fields = new ArrayList<AnnotatedField>(foundFields.size()); _fields.addAll(foundFields.values()); } } /* /********************************************************** /* Helper methods for resolving class annotations /* (resolution consisting of inheritance, overrides, /* and injection of mix-ins as necessary) /********************************************************** */ /** * Helper method for adding any mix-in annotations specified * class might have. */ protected void _addClassMixIns(AnnotationMap annotations, JavaType target) { if (_mixInResolver != null) { final Class<?> toMask = target.getRawClass(); _addClassMixIns(annotations, toMask, _mixInResolver.findMixInClassFor(toMask)); } } protected void _addClassMixIns(AnnotationMap annotations, Class<?> target) { if (_mixInResolver != null) { _addClassMixIns(annotations, target, _mixInResolver.findMixInClassFor(target)); } } protected void _addClassMixIns(AnnotationMap annotations, Class<?> toMask, Class<?> mixin) { if (mixin == null) { return; } // Ok, first: annotations from mix-in class itself: _addAnnotationsIfNotPresent(annotations, ClassUtil.findClassAnnotations(mixin)); /* And then from its supertypes, if any. But note that we will * only consider super-types up until reaching the masked * class (if found); this because often mix-in class * is a

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> sub-class (for convenience reasons). And if so, we * absolutely must NOT include super types of masked class, * as that would inverse precedence of annotations. */ for (Class<?> parent : ClassUtil.findSuperClasses(mixin, toMask, false)) { _addAnnotationsIfNotPresent(annotations, ClassUtil.findClassAnnotations(parent)); } } /* /********************************************************** /* Helper methods for populating creator (ctor, factory) information /********************************************************** */ protected void _addConstructorMixIns(Class<?> mixin) { MemberKey[] ctorKeys = null; int ctorCount = (_constructors == null) ? 0 : _constructors.size(); for (ClassUtil.Ctor ctor0 : ClassUtil.getConstructors(mixin)) { Constructor<?> ctor = ctor0.getConstructor(); if (ctor.getParameterTypes().length == 0) { if (_defaultConstructor != null) { _addMixOvers(ctor, _defaultConstructor, false); } } else { if (ctorKeys == null) { ctorKeys = new MemberKey[ctorCount]; for (int i = 0; i < ctorCount; ++i) { ctorKeys[i] = new MemberKey(_constructors.get(i).getAnnotated()); } } MemberKey key = new MemberKey(ctor); for (int i = 0; i < ctorCount; ++i) { if (!key.equals(ctorKeys[i])) { continue; } _addMixOvers(ctor, _constructors.get(i), true); break; } } } } protected void _addFactoryMixIns(Class<?> mixin) { MemberKey[] methodKeys = null; int methodCount = _creatorMethods.size(); for (Method m : ClassUtil.getDeclaredMethods(mixin)) { if (!Modifier.isStatic(m.getModifiers())) { continue; } if (m.getParameterTypes().length == 0) { continue; } if (methodKeys == null) { methodKeys = new MemberKey[methodCount]; for (int i = 0; i < methodCount; ++i) { methodKeys[i] = new MemberKey(_creatorMethods.get(i).getAnnotated()); } } MemberKey key = new MemberKey(m); for (int i = 0; i < methodCount; ++i) { if (!key.equals(methodKeys[i])) { continue; } _addMixOvers(m, _creatorMethods.get(i), true); break; } } } /* /********************************************************** /* Helper methods for populating method information /********************************************************** */ protected void _addMemberMethods(Class<?> cls, TypeResolutionContext typeContext, AnnotatedMethodMap methods, Class<?> mixInCls,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>'t be called) */ } else { // Well, or, as per [databind#515], multi-level merge within mixins... am = mixIns.find(m); if (am != null) { _addMixUnders(m, am); } else { // 03-Nov-2015, tatu: Mix-in method never called, should not need // to resolve generic types, so this class is fine as context mixIns.add(_constructMethod(m, this)); } } } } } /* /********************************************************** /* Helper methods for populating field information /********************************************************** */ protected Map<String,AnnotatedField> _findFields(JavaType type, TypeResolutionContext typeContext, Map<String,AnnotatedField> fields) { /* First, a quick test: we only care for regular classes (not * interfaces, primitive types etc), except for Object.class. * A simple check to rule out other cases is to see if there * is a super class or not. */ JavaType parent = type.getSuperClass(); if (parent != null) { final Class<?> cls = type.getRawClass(); // Let's add super-class' fields first, then ours. /* 21-Feb-2010, tatu: Need to handle masking: as per [JACKSON-226] * we otherwise get into trouble... */ fields = _findFields(parent, new TypeResolutionContext.Basic(_typeFactory, parent.getBindings()), fields); for (Field f : ClassUtil.getDeclaredFields(cls)) { // static fields not included (transients are at this point, filtered out later) if (!_isIncludableField(f)) { continue; } /* Ok now: we can (and need) not filter out ignorable fields * at this point; partly because mix-ins haven't been * added, and partly because logic can be done when * determining get/settability of the field. */ if (fields == null) { fields = new LinkedHashMap<String,AnnotatedField>(); } fields.put(f.getName(), _constructField(f, typeContext)); } // And then... any mix-in overrides? if (_mixInResolver != null) { Class<?> mixin = _mixInResolver.findMixInClassFor(cls); if (mixin != null) { _addFieldMixIns(mixin, cls, fields); } } } return fields; } /** * Method called to add field mix-ins from given mix-in class (and its fields) * into already collected actual fields (from introspected classes and their * super-classes) */ protected void _addFieldMixIns(Class<?> mixInCls, Class<?> targetClass,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Map<String,AnnotatedField> fields) { List<Class<?>> parents = ClassUtil.findSuperClasses(mixInCls, targetClass, true); for (Class<?> mixin : parents) { for (Field mixinField : ClassUtil.getDeclaredFields(mixin)) { // there are some dummy things (static, synthetic); better ignore if (!_isIncludableField(mixinField)) { continue; } String name = mixinField.getName(); // anything to mask? (if not, quietly ignore) AnnotatedField maskedField = fields.get(name); if (maskedField != null) { _addOrOverrideAnnotations(maskedField, mixinField.getDeclaredAnnotations()); } } } } /* /********************************************************** /* Helper methods, constructing value types /********************************************************** */ protected AnnotatedMethod _constructMethod(Method m, TypeResolutionContext typeContext) { /* note: parameter annotations not used for regular (getter, setter) * methods; only for creator methods (static factory methods) * -- at least not yet! */ if (_annotationIntrospector == null) { // when annotation processing is disabled return new AnnotatedMethod(typeContext, m, _emptyAnnotationMap(), null); } return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()), null); } protected AnnotatedConstructor _constructDefaultConstructor(ClassUtil.Ctor ctor, TypeResolutionContext typeContext) { if (_annotationIntrospector == null) { // when annotation processing is disabled return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _emptyAnnotationMap(), NO_ANNOTATION_MAPS); } return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _collectRelevantAnnotations(ctor.getDeclaredAnnotations()), NO_ANNOTATION_MAPS); } protected AnnotatedConstructor _constructNonDefaultConstructor(ClassUtil.Ctor ctor, TypeResolutionContext typeContext) { final int paramCount = ctor.getParamCount(); if (_annotationIntrospector == null) { // when annotation processing is disabled return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _emptyAnnotationMap(), _emptyAnnotationMaps(paramCount)); } /* Looks like JDK has discrepancy, whereas annotations for implicit 'this' * (for non-static inner classes) are NOT included, but type is? * Strange, sounds like a bug. Alas, we can't really fix that... */ if (paramCount == 0) { // no-arg default constructors, can simplify slightly return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _collectRelevantAnnotations(ctor.getDeclaredAnnotations()), NO_ANNOTATION_MAPS); } // Also: enum value constructors AnnotationMap[] resolvedAnnotations; Annotation[][] paramAnns = ctor.getParameterAnnotations(); if (param

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Count != paramAnns.length) { // Limits of the work-around (to avoid hiding real errors): // first, only applicable for member classes and then either: resolvedAnnotations = null; Class<?> dc = ctor.getDeclaringClass(); // (a) is enum, which have two extra hidden params (name, index) if (dc.isEnum() && (paramCount == paramAnns.length + 2)) { Annotation[][] old = paramAnns; paramAnns = new Annotation[old.length+2][]; System.arraycopy(old, 0, paramAnns, 2, old.length); resolvedAnnotations = _collectRelevantAnnotations(paramAnns); } else if (dc.isMemberClass()) { // (b) non-static inner classes, get implicit 'this' for parameter, not annotation if (paramCount == (paramAnns.length + 1)) { // hack attack: prepend a null entry to make things match Annotation[][] old = paramAnns; paramAnns = new Annotation[old.length+1][]; System.arraycopy(old, 0, paramAnns, 1, old.length); resolvedAnnotations = _collectRelevantAnnotations(paramAnns); } } if (resolvedAnnotations == null) { throw new IllegalStateException("Internal error: constructor for "+ctor.getDeclaringClass().getName() +" has mismatch: "+paramCount+" parameters; "+paramAnns.length+" sets of annotations"); } } else { resolvedAnnotations = _collectRelevantAnnotations(paramAnns); } return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _collectRelevantAnnotations(ctor.getDeclaredAnnotations()), resolvedAnnotations); } protected AnnotatedMethod _constructCreatorMethod(Method m, TypeResolutionContext typeContext) { final int paramCount = m.getParameterTypes().length; if (_annotationIntrospector == null) { // when annotation processing is disabled return new AnnotatedMethod(typeContext, m, _emptyAnnotationMap(), _emptyAnnotationMaps(paramCount)); } if (paramCount == 0) { // common enough we can slightly optimize return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()), NO_ANNOTATION_MAPS); } return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()), _collectRelevantAnnotations(m.getParameterAnnotations())); } protected AnnotatedField _constructField(Field f, TypeResolutionContext typeContext) { if (_annotationIntrospector == null) { // when annotation processing is disabled return new AnnotatedField(typeContext, f, _emptyAnnotationMap()); } return new AnnotatedField(typeContext, f, _collectRelevantAnnotations(f.getDeclaredAnnotations())); } private AnnotationMap _emptyAnnotationMap()

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> for (Annotation a : pa[i]) { target.addOrOverrideParam(i, a); } } } } /** * @param addParamAnnotations Whether parameter annotations are to be * added as well */ protected void _addMixOvers(Method mixin, AnnotatedMethod target, boolean addParamAnnotations) { _addOrOverrideAnnotations(target, mixin.getDeclaredAnnotations()); if (addParamAnnotations) { Annotation[][] pa = mixin.getParameterAnnotations(); for (int i = 0, len = pa.length; i < len; ++i) { for (Annotation a : pa[i]) { target.addOrOverrideParam(i, a); } } } } /** * Method that will add annotations from specified source method to target method, * but only if target does not yet have them. */ protected void _addMixUnders(Method src, AnnotatedMethod target) { _addAnnotationsIfNotPresent(target, src.getDeclaredAnnotations()); } private final boolean _isAnnotationBundle(Annotation ann) { return (_annotationIntrospector != null) && _annotationIntrospector.isAnnotationBundle(ann); } /** * Helper method that gets methods declared in given class; usually a simple thing, * but sometimes (as per [databind#785]) more complicated, depending on classloader * setup. * * @since 2.4.7 */ protected Method[] _findClassMethods(Class<?> cls) { try { return ClassUtil.getDeclaredMethods(cls); } catch (final NoClassDefFoundError ex) { // One of the methods had a class that was not found in the cls.getClassLoader. // Maybe the developer was nice and has a different class loader for this context. final ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null){ // Nope... this is going to end poorly throw ex; } final Class<?> contextClass; try { contextClass = loader.loadClass(cls.getName()); } catch (ClassNotFoundException e) { // !!! TODO: 08-May-2015, tatu: Chain appropriately once we have JDK 1.7/Java7 as baseline //ex.addSuppressed(e); Not until Jackson 2.7 throw ex; } return contextClass.getDeclaredMethods(); // Cross fingers } } /* /********************************************************** /* Other methods /********************************************************** */ @Override public String toString() { return "[AnnotedClass "+_class.getName()+"]"; } @Override public int hashCode() { return _class.getName().hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false;

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.util.*; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.util.ClassUtil; /** * Helper class used for aggregating information about a single * potential POJO property. */ public class POJOPropertyBuilder extends BeanPropertyDefinition implements Comparable<POJOPropertyBuilder> { /** * Whether property is being composed for serialization * (true) or deserialization (false) */ protected final boolean _forSerialization; protected final MapperConfig<?> _config; protected final AnnotationIntrospector _annotationIntrospector; /** * External name of logical property; may change with * renaming (by new instance being constructed using * a new name) */ protected final PropertyName _name; /** * Original internal name, derived from accessor, of this * property. Will not be changed by renaming. */ protected final PropertyName _internalName; protected Linked<AnnotatedField> _fields; protected Linked<AnnotatedParameter> _ctorParameters; protected Linked<AnnotatedMethod> _getters; protected Linked<AnnotatedMethod> _setters; public POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName) { this(config, ai, forSerialization, internalName, internalName); } protected POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName, PropertyName name) { _config = config; _annotationIntrospector = ai; _internalName = internalName; _name = name; _forSerialization = forSerialization; } public POJOPropertyBuilder(POJOPropertyBuilder src, PropertyName newName) { _config = src._config; _annotationIntrospector = src._annotationIntrospector; _internalName = src._internalName; _name = newName; _fields = src._fields; _ctorParameters = src._ctorParameters; _getters = src._getters; _setters = src._setters; _forSerialization = src._forSerialization; } /* /********************************************************** /* Fluent factory methods /********************************************************** */ @Override public POJOPropertyBuilder withName(PropertyName newName) { return new POJOPropertyBuilder(this, newName); } @Override public POJOPropertyBuilder withSimpleName(String newSimpleName) { PropertyName newName = _name.withSimpleName(newSimpleName); return (newName == _name) ? this : new POJOPropertyBuilder(this, newName); } /* /********************************************************** /* Comparable implementation: sort

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> alphabetically, except /* that properties with constructor parameters sorted /* before other properties /********************************************************** */ @Override public int compareTo(POJOPropertyBuilder other) { // first, if one has ctor params, that should come first: if (_ctorParameters != null) { if (other._ctorParameters == null) { return -1; } } else if (other._ctorParameters != null) { return 1; } /* otherwise sort by external name (including sorting of * ctor parameters) */ return getName().compareTo(other.getName()); } /* /********************************************************** /* BeanPropertyDefinition implementation, name/type /********************************************************** */ @Override public String getName() { return (_name == null) ? null : _name.getSimpleName(); } @Override public PropertyName getFullName() { return _name; } @Override public boolean hasName(PropertyName name) { return _name.equals(name); } @Override public String getInternalName() { return _internalName.getSimpleName(); } @Override public PropertyName getWrapperName() { /* 13-Mar-2013, tatu: Accessing via primary member SHOULD work, * due to annotation merging. However, I have seen some problems * with this access (for other annotations)... so if this should * occur, try commenting out full traversal code */ AnnotatedMember member = getPrimaryMember(); return (member == null || _annotationIntrospector == null) ? null : _annotationIntrospector.findWrapperName(member); /* return fromMemberAnnotations(new WithMember<PropertyName>() { @Override public PropertyName withMember(AnnotatedMember member) { return _annotationIntrospector.findWrapperName(member); } }); */ } @Override public boolean isExplicitlyIncluded() { return _anyExplicits(_fields) || _anyExplicits(_getters) || _anyExplicits(_setters) || _anyExplicits(_ctorParameters) ; } @Override public boolean isExplicitlyNamed() { return _anyExplicitNames(_fields) || _anyExplicitNames(_getters) || _anyExplicitNames(_setters) || _anyExplicitNames(_ctorParameters) ; } /* /********************************************************** /* BeanPropertyDefinition implementation, accessor access /********************************************************** */ @Override public boolean hasGetter() { return _getters != null; } @Override public boolean hasSetter() { return _setters != null; } @Override public boolean hasField() { return _fields != null; } @Override public boolean hasConstructorParameter() { return _ctorParameters != null; } @Override public boolean couldDeserialize() { return (_ctorParameters != null) || (_setters !=

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> null) || (_fields != null); } @Override public boolean couldSerialize() { return (_getters != null) || (_fields != null); } @Override public AnnotatedMethod getGetter() { // Easy with zero or one getters... Linked<AnnotatedMethod> curr = _getters; if (curr == null) { return null; } Linked<AnnotatedMethod> next = curr.next; if (next == null) { return curr.value; } // But if multiple, verify that they do not conflict... for (; next != null; next = next.next) { /* [JACKSON-255] Allow masking, i.e. do not report exception if one * is in super-class from the other */ Class<?> currClass = curr.value.getDeclaringClass(); Class<?> nextClass = next.value.getDeclaringClass(); if (currClass != nextClass) { if (currClass.isAssignableFrom(nextClass)) { // next is more specific curr = next; continue; } if (nextClass.isAssignableFrom(currClass)) { // current more specific continue; } } /* 30-May-2014, tatu: Three levels of precedence: * * 1. Regular getters ("getX") * 2. Is-getters ("isX") * 3. Implicit, possible getters ("x") */ int priNext = _getterPriority(next.value); int priCurr = _getterPriority(curr.value); if (priNext != priCurr) { if (priNext < priCurr) { curr = next; } continue; } throw new IllegalArgumentException("Conflicting getter definitions for property \""+getName()+"\": " +curr.value.getFullName()+" vs "+next.value.getFullName()); } // One more thing; to avoid having to do it again... _getters = curr.withoutNext(); return curr.value; } @Override public AnnotatedMethod getSetter() { // Easy with zero or one getters... Linked<AnnotatedMethod> curr = _setters; if (curr == null) { return null; } Linked<AnnotatedMethod> next = curr.next; if (next == null) { return curr.value; } // But if multiple, verify that they do not conflict... for (; next != null; next = next.next) { // Allow masking, i.e. do not fail if one is in super-class from the other Class<?> currClass = curr.value.getDeclaringClass(); Class<?> nextClass = next.value.getDeclaringClass(); if (currClass != nextClass) { if (currClass.isAssignableFrom(nextClass)) { // next is more specific curr = next; continue;

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } if (nextClass.isAssignableFrom(currClass)) { // current more specific continue; } } AnnotatedMethod nextM = next.value; AnnotatedMethod currM = curr.value; /* 30-May-2014, tatu: Two levels of precedence: * * 1. Regular setters ("setX(...)") * 2. Implicit, possible setters ("x(...)") */ int priNext = _setterPriority(nextM); int priCurr = _setterPriority(currM); if (priNext != priCurr) { if (priNext < priCurr) { curr = next; } continue; } // 11-Dec-2015, tatu: As per [databind#1033] allow pluggable conflict resolution if (_annotationIntrospector != null) { AnnotatedMethod pref = _annotationIntrospector.resolveSetterConflict(_config, currM, nextM); // note: should be one of nextM/currM; but no need to check if (pref == currM) { continue; } if (pref == nextM) { curr = next; continue; } } throw new IllegalArgumentException("Conflicting setter definitions for property \""+getName()+"\": " +curr.value.getFullName()+" vs "+next.value.getFullName()); } // One more thing; to avoid having to do it again... _setters = curr.withoutNext(); return curr.value; } @Override public AnnotatedField getField() { if (_fields == null) { return null; } // If multiple, verify that they do not conflict... AnnotatedField field = _fields.value; Linked<AnnotatedField> next = _fields.next; for (; next != null; next = next.next) { AnnotatedField nextField = next.value; Class<?> fieldClass = field.getDeclaringClass(); Class<?> nextClass = nextField.getDeclaringClass(); if (fieldClass != nextClass) { if (fieldClass.isAssignableFrom(nextClass)) { // next is more specific field = nextField; continue; } if (nextClass.isAssignableFrom(fieldClass)) { // getter more specific continue; } } throw new IllegalArgumentException("Multiple fields representing property \""+getName()+"\": " +field.getFullName()+" vs "+nextField.getFullName()); } return field; } @Override public AnnotatedParameter getConstructorParameter() { if (_ctorParameters == null) { return null; } /* Hmmh. Checking for constructor parameters is trickier; for one, * we must allow creator and factory method annotations. * If this is the case, constructor parameter has the precedence. * * So, for now, just try finding the first constructor parameter

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>; * if none, first factory method. And don't check for dups, if we must, * can start checking for them later on. */ Linked<AnnotatedParameter> curr = _ctorParameters; do { if (curr.value.getOwner() instanceof AnnotatedConstructor) { return curr.value; } curr = curr.next; } while (curr != null); return _ctorParameters.value; } @Override public Iterator<AnnotatedParameter> getConstructorParameters() { if (_ctorParameters == null) { return ClassUtil.emptyIterator(); } return new MemberIterator<AnnotatedParameter>(_ctorParameters); } @Override public AnnotatedMember getAccessor() { AnnotatedMember m = getGetter(); if (m == null) { m = getField(); } return m; } @Override public AnnotatedMember getMutator() { AnnotatedMember m = getConstructorParameter(); if (m == null) { m = getSetter(); if (m == null) { m = getField(); } } return m; } @Override public AnnotatedMember getNonConstructorMutator() { AnnotatedMember m = getSetter(); if (m == null) { m = getField(); } return m; } @Override public AnnotatedMember getPrimaryMember() { if (_forSerialization) { return getAccessor(); } return getMutator(); } protected int _getterPriority(AnnotatedMethod m) { final String name = m.getName(); // [databind#238]: Also, regular getters have precedence over "is-getters" if (name.startsWith("get") && name.length() > 3) { // should we check capitalization? return 1; } if (name.startsWith("is") && name.length() > 2) { return 2; } return 3; } protected int _setterPriority(AnnotatedMethod m) { final String name = m.getName(); if (name.startsWith("set") && name.length() > 3) { // should we check capitalization? return 1; } return 2; } /* /********************************************************** /* Implementations of refinement accessors /********************************************************** */ @Override public Class<?>[] findViews() { return fromMemberAnnotations(new WithMember<Class<?>[]>() { @Override public Class<?>[] withMember(AnnotatedMember member) { return _annotationIntrospector.findViews(member); } }); } @Override public AnnotationIntrospector.ReferenceProperty findReferenceType() { return fromMemberAnnotations(new WithMember<AnnotationIntrospector.ReferenceProperty>() { @Override public AnnotationIntrospector.ReferenceProperty withMember(AnnotatedMember member) { return

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Access withMember(AnnotatedMember member) { return _annotationIntrospector.findPropertyAccess(member); } }, JsonProperty.Access.AUTO); } /* /********************************************************** /* Data aggregation /********************************************************** */ public void addField(AnnotatedField a, PropertyName name, boolean explName, boolean visible, boolean ignored) { _fields = new Linked<AnnotatedField>(a, _fields, name, explName, visible, ignored); } public void addCtor(AnnotatedParameter a, PropertyName name, boolean explName, boolean visible, boolean ignored) { _ctorParameters = new Linked<AnnotatedParameter>(a, _ctorParameters, name, explName, visible, ignored); } public void addGetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) { _getters = new Linked<AnnotatedMethod>(a, _getters, name, explName, visible, ignored); } public void addSetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) { _setters = new Linked<AnnotatedMethod>(a, _setters, name, explName, visible, ignored); } /** * Method for adding all property members from specified collector into * this collector. */ public void addAll(POJOPropertyBuilder src) { _fields = merge(_fields, src._fields); _ctorParameters = merge(_ctorParameters, src._ctorParameters); _getters= merge(_getters, src._getters); _setters = merge(_setters, src._setters); } private static <T> Linked<T> merge(Linked<T> chain1, Linked<T> chain2) { if (chain1 == null) { return chain2; } if (chain2 == null) { return chain1; } return chain1.append(chain2); } /* /********************************************************** /* Modifications /********************************************************** */ /** * Method called to remove all entries that are marked as * ignored. */ public void removeIgnored() { _fields = _removeIgnored(_fields); _getters = _removeIgnored(_getters); _setters = _removeIgnored(_setters); _ctorParameters = _removeIgnored(_ctorParameters); } /** * @param inferMutators Whether mutators can be "pulled in" by visible * accessors or not. */ public void removeNonVisible(boolean inferMutators) { /* 07-Jun-2015, tatu: With 2.6, we will allow optional definition * of explicit access type for property; if not "AUTO", it will * dictate how visibility checks are applied. */ JsonProperty.Access acc = findAccess(); if (acc == null) { acc = JsonProperty.Access

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>'s visible if (!node.isVisible) { continue; } throw new IllegalStateException("Conflicting/ambiguous property name definitions (implicit name '" +_name+"'): found multiple explicit names: " +newNames+", but also implicit accessor: "+node); } POJOPropertyBuilder prop = props.get(name); if (prop == null) { prop = new POJOPropertyBuilder(_config, _annotationIntrospector, _forSerialization, _internalName, name); props.put(name, prop); } // ultra-clumsy, part 2 -- lambdas would be nice here if (firstAcc == _fields) { Linked<AnnotatedField> n2 = (Linked<AnnotatedField>) node; prop._fields = n2.withNext(prop._fields); } else if (firstAcc == _getters) { Linked<AnnotatedMethod> n2 = (Linked<AnnotatedMethod>) node; prop._getters = n2.withNext(prop._getters); } else if (firstAcc == _setters) { Linked<AnnotatedMethod> n2 = (Linked<AnnotatedMethod>) node; prop._setters = n2.withNext(prop._setters); } else if (firstAcc == _ctorParameters) { Linked<AnnotatedParameter> n2 = (Linked<AnnotatedParameter>) node; prop._ctorParameters = n2.withNext(prop._ctorParameters); } else { throw new IllegalStateException("Internal error: mismatched accessors, property: "+this); } } } private Set<PropertyName> _findExplicitNames(Linked<? extends AnnotatedMember> node, Set<PropertyName> renamed) { for (; node != null; node = node.next) { /* 30-Mar-2014, tatu: Second check should not be needed, but seems like * removing it can cause nasty exceptions with certain version * combinations (2.4 databind, an older module). * So leaving it in for now until this is resolved * (or version beyond 2.4) */ if (!node.isNameExplicit || node.name == null) { continue; } if (renamed == null) { renamed = new HashSet<PropertyName>(); } renamed.add(node.name); } return renamed; } // For trouble-shooting @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[Property '").append(_name) .append("'; ctors: ").append(_ctorParameters) .append(", field(s): ").append(_fields) .append(", getter(s): ").append(_getters) .append(", setter(s): ").append(_setters) ; sb.append("]"); return sb.toString(); } /* /********************************************************** /* Helper methods

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> p.setCurrentValue(bean); final SettableBeanProperty[] props = _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } } else { // just skip? p.skipChildren(); } ++i; } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } @Override public Object deserialize(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException { // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); /* No good way to verify that we have an array... although could I guess * check via JsonParser. So let's assume everything is working fine, for now. */ if (_injectables != null) { injectValues(ctxt, bean); } final SettableBeanProperty[] props = _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } } else { // just skip? p.skipChildren(); } ++i; } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } // needed since 2.1 @Override public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException { return _deserializeFrom

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>NonArray(p, ctxt); } /* /********************************************************** /* Helper methods, non-standard creation /********************************************************** */ /** * Alternate deserialization method that has to check many more configuration * aspects than the "vanilla" processing. */ protected Object _deserializeNonVanilla(JsonParser p, DeserializationContext ctxt) throws IOException { if (_nonStandardCreation) { return _deserializeWithCreator(p, ctxt); } final Object bean = _valueInstantiator.createUsingDefault(ctxt); // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); if (_injectables != null) { injectValues(ctxt, bean); } Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; final SettableBeanProperty[] props = _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; ++i; if (prop != null) { // normal case if (activeView == null || prop.visibleInView(activeView)) { try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } continue; } } // otherwise, skip it (view-filtered, no prop etc) p.skipChildren(); } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } protected Object _deserializeWithCreator(JsonParser p, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { return _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } if (_propertyBasedCreator != null) { return _deserializeUsingPropertyBased(p, ctxt); } // should only occur for abstract types... if (_beanType.isAbstract()) { throw JsonMappingException.from(p, "Can not instantiate abstract type "+_beanType +" (need to add/enable type information?)"); } throw JsonMappingException.from(p, "No suitable constructor found for type " +_beanType+": can not instantiate from JSON object (need to add/enable type information?)"); } /** * Method called to deserialize

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> bean using "property-based creator": * this means that a non-default constructor or factory method is * called, and then possibly other setters. The trick is that * values for creator method need to be buffered, first; and * due to non-guaranteed ordering possibly some other properties * as well. */ @Override protected final Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); final SettableBeanProperty[] props = _orderedProperties; final int propCount = props.length; int i = 0; Object bean = null; for (; p.nextToken() != JsonToken.END_ARRAY; ++i) { SettableBeanProperty prop = (i < propCount) ? props[i] : null; if (prop == null) { // we get null if there are extra elements; maybe otherwise too? p.skipChildren(); continue; } // if we have already constructed POJO, things are simple: if (bean != null) { try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } continue; } final String propName = prop.getName(); // if not yet, maybe we got a creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // Last creator property to set? if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); continue; // never gets here } // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); // polymorphic? if (bean.getClass() != _beanType.getRawClass()) { /* 23-Jul-2012, tatu: Not sure if these could ever be properly * supported (since ordering of elements may not be guaranteed); * but make explicitly non-supported for now. */ throw ctxt.mappingException("Can not support implicit polymorphic deserialization for POJOs-as-Arrays style: " +"nominal type %s, actual type %s", _beanType.getRawClass().getName(), bean.getClass().getName()); } } continue; } // Object Id property? if (buffer.readIdProperty(propName)) { continue; } // regular property? needs buffering buffer.bufferProperty(prop, prop.deserialize(p,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> ctxt)); } // In case we didn't quite get all the creator properties, we may have to do this: if (bean == null) { try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapInstantiationProblem(e, ctxt); return null; // never gets here } } return bean; } /* /********************************************************** /* Helper methods, error reporting /********************************************************** */ protected Object _deserializeFromNonArray(JsonParser p, DeserializationContext ctxt) throws IOException { // Let's start with failure throw ctxt.mappingException("Can not deserialize a POJO (of type %s) from non-Array representation (token: %s): " +"type/property designed to be serialized as JSON Array", _beanType.getRawClass().getName(), p.getCurrentToken()); // in future, may allow use of "standard" POJO serialization as well; if so, do: //return _delegate.deserialize(p, ctxt); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } } else if (_suppressableValue.equals(value)) { return; } } if (value == bean) { // simple check for direct cycles // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } gen.writeFieldName(_name); if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } } // This one's fine as-is from base class //public void serializeAsOmittedField(Object bean, JsonGenerator jgen, SerializerProvider prov) throws Exception @Override public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // NOTE: mostly copied from base class, but off-lined get() access final Object value = value(bean, gen, prov); if (value == null) { if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else { gen.writeNull(); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { serializeAsPlaceholder(bean, gen, prov); return; } } if (value == bean) { if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } } // This one's fine as-is from base class //public void serializeAsPlaceholder(Object bean, JsonGenerator jgen, SerializerProvider prov) }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; import java.lang.reflect.Type; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; /** * Also: default bean access will not do much good with Class.class. But * we can just serialize the class name and that should be enough. */ @SuppressWarnings("serial") public class ClassSerializer extends StdScalarSerializer<Class<?>> { public ClassSerializer() { super(Class.class, false); } @Override public void serialize(Class<?> value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeString(value.getName()); } @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("string", true); } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitStringFormat(visitor, typeHint); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>) { int kind; // first common types: if (raw == String.class || raw == Object.class) { return StringKD.forType(raw); } else if (raw == UUID.class) { kind = TYPE_UUID; } else if (raw == Integer.class) { kind = TYPE_INT; } else if (raw == Long.class) { kind = TYPE_LONG; } else if (raw == Date.class) { kind = TYPE_DATE; } else if (raw == Calendar.class) { kind = TYPE_CALENDAR; // then less common ones... } else if (raw == Boolean.class) { kind = TYPE_BOOLEAN; } else if (raw == Byte.class) { kind = TYPE_BYTE; } else if (raw == Character.class) { kind = TYPE_CHAR; } else if (raw == Short.class) { kind = TYPE_SHORT; } else if (raw == Float.class) { kind = TYPE_FLOAT; } else if (raw == Double.class) { kind = TYPE_DOUBLE; } else if (raw == URI.class) { kind = TYPE_URI; } else if (raw == URL.class) { kind = TYPE_URL; } else if (raw == Class.class) { kind = TYPE_CLASS; } else if (raw == Locale.class) { FromStringDeserializer<?> deser = FromStringDeserializer.findDeserializer(Locale.class); return new StdKeyDeserializer(TYPE_LOCALE, raw, deser); } else if (raw == Currency.class) { FromStringDeserializer<?> deser = FromStringDeserializer.findDeserializer(Currency.class); return new StdKeyDeserializer(TYPE_CURRENCY, raw, deser); } else { return null; } return new StdKeyDeserializer(kind, raw); } @Override public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { if (key == null) { // is this even legal call? return null; } try { Object result = _parse(key, ctxt); if (result != null) { return result; } } catch (Exception re) { throw ctxt.weirdKeyException(_keyClass, key, "not a valid representation: "+re.getMessage()); } if (_keyClass.isEnum() && ctxt.getConfig().isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) { return null; } throw ctxt.weirdKeyException(_keyClass, key, "not a valid representation"); } public Class<?> getKeyClass() { return _keyClass; } protected Object _parse(String key, DeserializationContext ctxt) throws Exception { switch (_kind) { case TYPE_BOOLEAN: if ("true".equals

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(key)) { return Boolean.TRUE; } if ("false".equals(key)) { return Boolean.FALSE; } throw ctxt.weirdKeyException(_keyClass, key, "value not 'true' or 'false'"); case TYPE_BYTE: { int value = _parseInt(key); // as per [JACKSON-804], allow range up to 255, inclusive if (value < Byte.MIN_VALUE || value > 255) { throw ctxt.weirdKeyException(_keyClass, key, "overflow, value can not be represented as 8-bit value"); } return Byte.valueOf((byte) value); } case TYPE_SHORT: { int value = _parseInt(key); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw ctxt.weirdKeyException(_keyClass, key, "overflow, value can not be represented as 16-bit value"); } return Short.valueOf((short) value); } case TYPE_CHAR: if (key.length() == 1) { return Character.valueOf(key.charAt(0)); } throw ctxt.weirdKeyException(_keyClass, key, "can only convert 1-character Strings"); case TYPE_INT: return _parseInt(key); case TYPE_LONG: return _parseLong(key); case TYPE_FLOAT: // Bounds/range checks would be tricky here, so let's not bother even trying... return Float.valueOf((float) _parseDouble(key)); case TYPE_DOUBLE: return _parseDouble(key); case TYPE_LOCALE: try { return _deser._deserialize(key, ctxt); } catch (IOException e) { throw ctxt.weirdKeyException(_keyClass, key, "unable to parse key as locale"); } case TYPE_CURRENCY: try { return _deser._deserialize(key, ctxt); } catch (IOException e) { throw ctxt.weirdKeyException(_keyClass, key, "unable to parse key as currency"); } case TYPE_DATE: return ctxt.parseDate(key); case TYPE_CALENDAR: java.util.Date date = ctxt.parseDate(key); return (date == null) ? null : ctxt.constructCalendar(date); case TYPE_UUID: return UUID.fromString(key); case TYPE_URI: return URI.create(key); case TYPE_URL: return new URL(key); case TYPE_CLASS: try { return ctxt.findClass(key); } catch (Exception e) { throw ctxt.weirdKeyException(_keyClass, key, "unable to parse key as Class"); } } return null; } /* /********************************************************** /* Helper methods for

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; /** * Intermediate base deserializer class that adds more shared accessor * so that other classes can access information about contained (value) types */ @SuppressWarnings("serial") public abstract class ContainerDeserializerBase<T> extends StdDeserializer<T> { protected ContainerDeserializerBase(JavaType selfType) { super(selfType); } /* /********************************************************** /* Overrides /********************************************************** */ @Override public SettableBeanProperty findBackReference(String refName) { JsonDeserializer<Object> valueDeser = getContentDeserializer(); if (valueDeser == null) { throw new IllegalArgumentException("Can not handle managed/back reference '"+refName +"': type: container deserializer of type "+getClass().getName()+" returned null for 'getContentDeserializer()'"); } return valueDeser.findBackReference(refName); } /* /********************************************************** /* Extended API /********************************************************** */ /** * Accessor for declared type of contained value elements; either exact * type, or one of its supertypes. */ public abstract JavaType getContentType(); /** * Accesor for deserializer use for deserializing content values. */ public abstract JsonDeserializer<Object> getContentDeserializer(); /* /********************************************************** /* Shared methods for sub-classes /********************************************************** */ /** * Helper method called by various Map(-like) deserializers. */ protected void wrapAndThrow(Throwable t, Object ref, String key) throws IOException { // to handle StackOverflow: while (t instanceof InvocationTargetException && t.getCause() != null) { t = t.getCause(); } // Errors and "plain" IOExceptions to be passed as is if (t instanceof Error) { throw (Error) t; } // ... except for mapping exceptions if (t instanceof IOException && !(t instanceof JsonMappingException)) { throw (IOException) t; } // for [databind#1141] if (key == null) { key = "N/A"; } throw JsonMappingException.wrapWithPath(t, ref, key); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> String msg, Throwable problem) { return new JsonMappingException(g, msg, problem); } /** * @since 2.7 */ public static JsonMappingException from(DeserializationContext ctxt, String msg) { return new JsonMappingException(ctxt.getParser(), msg); } /** * @since 2.7 */ public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t) { return new JsonMappingException(ctxt.getParser(), msg, t); } /** * @since 2.7 */ public static JsonMappingException from(SerializerProvider ctxt, String msg) { /* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as * SerializerProvider instance does not currently hold on to generator... */ JsonGenerator g = null; return new JsonMappingException(g, msg); } /** * @since 2.7 */ public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem) { /* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as * SerializerProvider instance does not currently hold on to generator... */ JsonGenerator g = null; return new JsonMappingException(g, msg, problem); } /** * Factory method used when "upgrading" an {@link IOException} into * {@link JsonMappingException}: usually only needed to comply with * a signature. * * @since 2.1 */ public static JsonMappingException fromUnexpectedIOE(IOException src) { return new JsonMappingException(null, String.format("Unexpected IOException (of type %s): %s", src.getClass().getName(), src.getMessage())); } /** * Method that can be called to either create a new JsonMappingException * (if underlying exception is not a JsonMappingException), or augment * given exception with given path/reference information. * * This version of method is called when the reference is through a * non-indexed object, such as a Map or POJO/bean. */ public static JsonMappingException wrapWithPath(Throwable src, Object refFrom, String refFieldName) { return wrapWithPath(src, new Reference(refFrom, refFieldName)); } /** * Method that can be called to either create a new JsonMappingException * (if underlying exception is not a JsonMappingException), or augment * given exception with given path/reference information. * * This version of method is called when the reference is through an * index, which happens with arrays and Collections. */ public static JsonMappingException wrapWithPath(Throwable src, Object refFrom, int index) { return wrapWithPath(src, new Reference(refFrom, index)); } /** *

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> Method that can be called to either create a new JsonMappingException * (if underlying exception is not a JsonMappingException), or augment * given exception with given path/reference information. */ @SuppressWarnings("resource") public static JsonMappingException wrapWithPath(Throwable src, Reference ref) { JsonMappingException jme; if (src instanceof JsonMappingException) { jme = (JsonMappingException) src; } else { String msg = src.getMessage(); // Let's use a more meaningful placeholder if all we have is null if (msg == null || msg.length() == 0) { msg = "(was "+src.getClass().getName()+")"; } // 17-Aug-2015, tatu: Let's also pass the processor (parser/generator) along Closeable proc = null; if (src instanceof JsonProcessingException) { Object proc0 = ((JsonProcessingException) src).getProcessor(); if (proc0 instanceof Closeable) { proc = (Closeable) proc0; } } jme = new JsonMappingException(proc, msg, src); } jme.prependPath(ref); return jme; } /* /********************************************************** /* Accessors/mutators /********************************************************** */ /** * Method for accessing full structural path within type hierarchy * down to problematic property. */ public List<Reference> getPath() { if (_path == null) { return Collections.emptyList(); } return Collections.unmodifiableList(_path); } /** * Method for accesing description of path that lead to the * problem that triggered this exception */ public String getPathReference() { return getPathReference(new StringBuilder()).toString(); } public StringBuilder getPathReference(StringBuilder sb) { _appendPathDesc(sb); return sb; } /** * Method called to prepend a reference information in front of * current path */ public void prependPath(Object referrer, String fieldName) { Reference ref = new Reference(referrer, fieldName); prependPath(ref); } /** * Method called to prepend a reference information in front of * current path */ public void prependPath(Object referrer, int index) { Reference ref = new Reference(referrer, index); prependPath(ref); } public void prependPath(Reference r) { if (_path == null) { _path = new LinkedList<Reference>(); } /* Also: let's not increase without bounds. Could choose either * head or tail; tail is easier (no need to ever remove), as * well as potentially more useful so let's use it: */ if (_path.size() < MAX_REFS_TO_LIST) { _path.addFirst(r); } } /* /********************************************************** /* Overridden methods /**********************************************************

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> */ @Override // since 2.7.5 public Object getProcessor() { return _processor; } @Override public String getLocalizedMessage() { return _buildMessage(); } /** * Method is overridden so that we can properly inject description * of problem path, if such is defined. */ @Override public String getMessage() { return _buildMessage(); } protected String _buildMessage() { /* First: if we have no path info, let's just use parent's * definition as is */ String msg = super.getMessage(); if (_path == null) { return msg; } StringBuilder sb = (msg == null) ? new StringBuilder() : new StringBuilder(msg); /* 18-Feb-2009, tatu: initially there was a linefeed between * message and path reference; but unfortunately many systems * (loggers, junit) seem to assume linefeeds are only added to * separate stack trace. */ sb.append(" (through reference chain: "); sb = getPathReference(sb); sb.append(')'); return sb.toString(); } @Override public String toString() { return getClass().getName()+": "+getMessage(); } /* /********************************************************** /* Internal methods /********************************************************** */ protected void _appendPathDesc(StringBuilder sb) { if (_path == null) { return; } Iterator<Reference> it = _path.iterator(); while (it.hasNext()) { sb.append(it.next().toString()); if (it.hasNext()) { sb.append("->"); } } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>TypeSuffixForScalar(value, gen); *</pre> * and implementations for type serialized as JSON Arrays or Objects would differ slightly, * as <code>START-ARRAY</code>/<code>END-ARRAY</code> and * <code>START-OBJECT</code>/<code>END-OBJECT</code> pairs * need to be properly handled with respect to serializing of contents. * * @param value Value to serialize; can <b>not</b> be null. * @param gen Generator used to output resulting Json content * @param serializers Provider that can be used to get serializers for * serializing Objects value contains, if any. * @param typeSer Type serializer to use for including type information */ public void serializeWithType(T value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { Class<?> clz = handledType(); if (clz == null) { clz = value.getClass(); } throw serializers.mappingException("Type id handling not implemented for type %s (by serializer of type %s)", clz.getName(), getClass().getName()); } /* /********************************************************** /* Other accessors /********************************************************** */ /** * Method for accessing type of Objects this serializer can handle. * Note that this information is not guaranteed to be exact -- it * may be a more generic (super-type) -- but it should not be * incorrect (return a non-related type). *<p> * Default implementation will return null, which essentially means * same as returning <code>Object.class</code> would; that is, that * nothing is known about handled type. *<p> */ public Class<T> handledType() { return null; } /** * Method called to check whether given serializable value is * considered "empty" value (for purposes of suppressing serialization * of empty values). *<p> * Default implementation will consider only null values to be empty. * * @since 2.0 * * @deprecated Since 2.5 Use {@link #isEmpty(SerializerProvider, Object)} instead; * will be removed from 2.8 */ @Deprecated public boolean isEmpty(T value) { return isEmpty(null, value); } /** * Method called to check whether given serializable value is * considered "empty" value (for purposes of suppressing serialization * of empty values). *<p> * Default implementation will consider only null values to be empty. *<p> * NOTE: replaces {@link #isEmpty(Object)}, deprecated in 2.5 * * @since 2.5 */ public boolean isEmpty(SerializerProvider provider, T value) { return (value == null); } /** * Method that can be called to see whether this serializer instance * will use Object Id to handle

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.util; /** * Simple tag interface mostly to allow sorting by name. */ public interface Named { public String getName(); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Builder(trb)); } @Override public DeserializationConfig with(SubtypeResolver str) { return (_subtypeResolver == str) ? this : new DeserializationConfig(this, str); } @Override public DeserializationConfig with(PropertyNamingStrategy pns) { return _withBase(_base.withPropertyNamingStrategy(pns)); } @Override public DeserializationConfig withRootName(PropertyName rootName) { if (rootName == null) { if (_rootName == null) { return this; } } else if (rootName.equals(_rootName)) { return this; } return new DeserializationConfig(this, rootName); } @Override public DeserializationConfig with(TypeFactory tf) { return _withBase( _base.withTypeFactory(tf)); } @Override public DeserializationConfig with(DateFormat df) { return _withBase(_base.withDateFormat(df)); } @Override public DeserializationConfig with(HandlerInstantiator hi) { return _withBase(_base.withHandlerInstantiator(hi)); } @Override public DeserializationConfig withInsertedAnnotationIntrospector(AnnotationIntrospector ai) { return _withBase(_base.withInsertedAnnotationIntrospector(ai)); } @Override public DeserializationConfig withAppendedAnnotationIntrospector(AnnotationIntrospector ai) { return _withBase(_base.withAppendedAnnotationIntrospector(ai)); } @Override public DeserializationConfig withView(Class<?> view) { return (_view == view) ? this : new DeserializationConfig(this, view); } @Override public DeserializationConfig with(Locale l) { return _withBase(_base.with(l)); } @Override public DeserializationConfig with(TimeZone tz) { return _withBase(_base.with(tz)); } @Override public DeserializationConfig with(Base64Variant base64) { return _withBase(_base.with(base64)); } @Override public DeserializationConfig with(ContextAttributes attrs) { return (attrs == _attributes) ? this : new DeserializationConfig(this, attrs); } private final DeserializationConfig _withBase(BaseSettings newBase) { return (_base == newBase) ? this : new DeserializationConfig(this, newBase); } /* /********************************************************** /* Life-cycle, DeserializationFeature-based factory methods /********************************************************** */ /** * Fluent factory method that will construct and return a new configuration * object instance with specified features enabled. */ public DeserializationConfig with(DeserializationFeature feature) { int newDeserFeatures = (_deserFeatures | feature.getMask()); return (newDeserFeatures == _deserFeatures) ? this : new DeserializationConfig(this, _mapperFeatures, new

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.*; import com.fasterxml.jackson.databind.JavaType; /** * Object that represents method parameters, mostly so that associated * annotations can be processed conveniently. Note that many of accessors * can not return meaningful values since parameters do not have stand-alone * JDK objects associated; so access should mostly be limited to checking * annotation values which are properly aggregated and included. */ public final class AnnotatedParameter extends AnnotatedMember { private static final long serialVersionUID = 1L; /** * Member (method, constructor) that this parameter belongs to */ protected final AnnotatedWithParams _owner; /** * JDK type of the parameter, possibly contains generic type information */ protected final JavaType _type; /** * Index of the parameter within argument list */ protected final int _index; /* /********************************************************** /* Life-cycle /********************************************************** */ public AnnotatedParameter(AnnotatedWithParams owner, JavaType type, AnnotationMap annotations, int index) { super((owner == null) ? null : owner.getTypeContext(), annotations); _owner = owner; _type = type; _index = index; } @Override public AnnotatedParameter withAnnotations(AnnotationMap ann) { if (ann == _annotations) { return this; } return _owner.replaceParameterAnnotations(_index, ann); } /* /********************************************************** /* Annotated impl /********************************************************** */ /** * Since there is no matching JDK element, this method will * always return null */ @Override public AnnotatedElement getAnnotated() { return null; } /** * Returns modifiers of the constructor, as parameters do not * have independent modifiers. */ @Override public int getModifiers() { return _owner.getModifiers(); } /** * Parameters have no names in bytecode (unlike in source code), * will always return empty String (""). */ @Override public String getName() { return ""; } @Override public Class<?> getRawType() { return _type.getRawClass(); } @Override public JavaType getType() { return _type; } @Deprecated @Override public Type getGenericType() { return _owner.getGenericParameterType(_index); } /* /********************************************************** /* AnnotatedMember extras /********************************************************** */ @Override public Class<?> getDeclaringClass() { return _owner.getDeclaringClass(); } @Override public Member getMember() { /* This is bit tricky: since there is no JDK equivalent; can either * return null or owner... let's do latter, for now. */ return _owner.getMember(); } @Override public void setValue(Object pojo, Object value) throws UnsupportedOperationException { throw new UnsupportedOperationException("

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>Cannot call setValue() on constructor parameter of " +getDeclaringClass().getName()); } @Override public Object getValue(Object pojo) throws UnsupportedOperationException { throw new UnsupportedOperationException("Cannot call getValue() on constructor parameter of " +getDeclaringClass().getName()); } /* /********************************************************** /* Extended API /********************************************************** */ public Type getParameterType() { return _type; } /** * Accessor for 'owner' of this parameter; method or constructor that * has this parameter as member of its argument list. * * @return Owner (member or creator) object of this parameter */ public AnnotatedWithParams getOwner() { return _owner; } /** * Accessor for index of this parameter within argument list * * @return Index of this parameter within argument list */ public int getIndex() { return _index; } /* /******************************************************** /* Other /******************************************************** */ @Override public int hashCode() { return _owner.hashCode() + _index; } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; AnnotatedParameter other = (AnnotatedParameter) o; return other._owner.equals(_owner) && (other._index == _index); } @Override public String toString() { return "[parameter #"+getIndex()+", annotations: "+_annotations+"]"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 64-bit integer values. */ public class BigIntegerNode extends NumericNode { private final static BigInteger MIN_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); private final static BigInteger MAX_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); private final static BigInteger MIN_LONG = BigInteger.valueOf(Long.MIN_VALUE); private final static BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE); final protected BigInteger _value; /* /********************************************************** /* Construction /********************************************************** */ public BigIntegerNode(BigInteger v) { _value = v; } public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.BIG_INTEGER; } @Override public boolean isIntegralNumber() { return true; } @Override public boolean isBigInteger() { return true; } @Override public boolean canConvertToInt() { return (_value.compareTo(MIN_INTEGER) >= 0) && (_value.compareTo(MAX_INTEGER) <= 0); } @Override public boolean canConvertToLong() { return (_value.compareTo(MIN_LONG) >= 0) && (_value.compareTo(MAX_LONG) <= 0); } @Override public Number numberValue() { return _value; } @Override public short shortValue() { return _value.shortValue(); } @Override public int intValue() { return _value.intValue(); } @Override public long longValue() { return _value.longValue(); } @Override public BigInteger bigIntegerValue() { return _value; } @Override public float floatValue() { return _value.floatValue(); } @Override public double doubleValue() { return _value.doubleValue(); } @Override public BigDecimal decimalValue() { return new BigDecimal(_value); } /* /********************************************************** /* General type coercions /********************************************************** */ @Override public String asText() { return _value.toString(); } @Override public boolean asBoolean(boolean defaultValue) { return !BigInteger.ZERO.equals(_value); } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(Object o) { if (o == this) return true; if (o == null) return false; if (!(o instanceof BigIntegerNode)) { return false; } return ((BigIntegerNode) o)._value.equals(_value); } @Override public int hashCode() { return _value.hashCode(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> if (_annotations == null || !_annotations.containsKey(ann.annotationType())) { _add(ann); return true; } return false; } /** * Method called to add specified annotation in the Map. * * @return True if the addition changed the contents, that is, this map did not * already have specified annotation */ public boolean add(Annotation ann) { return _add(ann); } @Override public String toString() { if (_annotations == null) { return "[null]"; } return _annotations.toString(); } /* /********************************************************** /* Helper methods /********************************************************** */ protected final boolean _add(Annotation ann) { if (_annotations == null) { _annotations = new HashMap<Class<?>,Annotation>(); } Annotation previous = _annotations.put(ann.annotationType(), ann); return (previous == null) || !previous.equals(ann); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>ual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // May need to resolve types for delegate-based creators: JsonDeserializer<Object> delegateDeser = null; if ((_valueInstantiator != null) && _valueInstantiator.canCreateUsingDelegate()) { JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); if (delegateType == null) { throw new IllegalArgumentException("Invalid delegate-creator definition for "+_collectionType +": value instantiator ("+_valueInstantiator.getClass().getName() +") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'"); } delegateDeser = findDeserializer(ctxt, delegateType, property); } // [databind#1043]: allow per-property allow-wrapping of single overrides: // 11-Dec-2015, tatu: Should we pass basic `Collection.class`, or more refined? Mostly // comes down to "List vs Collection" I suppose... for now, pass Collection Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // also, often value deserializer is resolved here: JsonDeserializer<?> valueDeser = _valueDeserializer; // May have a content converter valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); final JavaType vt = _collectionType.getContentType(); if (valueDeser == null) { valueDeser = ctxt.findContextualValueDeserializer(vt, property); } else { // if directly assigned, probably not yet contextual, so: valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, vt); } // and finally, type deserializer needs context as well TypeDeserializer valueTypeDeser = _valueTypeDeserializer; if (valueTypeDeser != null) { valueTypeDeser = valueTypeDeser.forProperty(property); } return withResolved(delegateDeser, valueDeser, valueTypeDeser, unwrapSingle); } /* /********************************************************** /* ContainerDeserializerBase API /********************************************************** */ @Override public JavaType getContentType() { return _collectionType.getContentType(); } @Override public JsonDeserializer<Object> getContentDeserializer() { return _valueDeserializer; } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @SuppressWarnings("unchecked") @Override public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { return (Collection<Object>) _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } /* [JACKSON-620]: empty String may be ok; bit tricky to check,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> (prop == null) { continue; } String key = getPropertyName(prop); int slot = _hashCode(key); int ix = (slot<<1); // primary slot not free? if (hashed[ix] != null) { // secondary? ix = (hashSize + (slot >> 1)) << 1; if (hashed[ix] != null) { // ok, spill over. ix = ((hashSize + (hashSize >> 1) ) << 1) + spillCount; spillCount += 2; if (ix >= hashed.length) { hashed = Arrays.copyOf(hashed, hashed.length + 4); } } } //System.err.println(" add '"+key+" at #"+(ix>>1)+"/"+size+" (hashed at "+slot+")"); hashed[ix] = key; hashed[ix+1] = prop; } /* for (int i = 0; i < hashed.length; i += 2) { System.err.printf("#%02d: %s\n", i>>1, (hashed[i] == null) ? "-" : hashed[i]); } */ _hashArea = hashed; _spillCount = spillCount; } private final static int findSize(int size) { if (size <= 5) { return 8; } if (size <= 12) { return 16; } int needed = size + (size >> 2); // at most 80% full int result = 32; while (result < needed) { result += result; } return result; } /** * @since 2.6 */ public static BeanPropertyMap construct(Collection<SettableBeanProperty> props, boolean caseInsensitive) { return new BeanPropertyMap(caseInsensitive, props); } /** * Fluent copy method that creates a new instance that is a copy * of this instance except for one additional property that is * passed as the argument. * Note that method does not modify this instance but constructs * and returns a new one. */ public BeanPropertyMap withProperty(SettableBeanProperty newProp) { // First: may be able to just replace? String key = getPropertyName(newProp); for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if ((prop != null) && prop.getName().equals(key)) { _hashArea[i] = newProp; _propsInOrder[_findFromOrdered(prop)] = newProp; return this; } } // If not, append final int slot = _

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>); } /** * Specialized method that can be used to replace an existing entry * (note: entry MUST exist; otherwise exception is thrown) with * specified replacement. */ public void replace(SettableBeanProperty newProp) { String key = getPropertyName(newProp); int ix = _findIndexInHash(key); if (ix >= 0) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[ix]; _hashArea[ix] = newProp; // also, replace in in-order _propsInOrder[_findFromOrdered(prop)] = newProp; return; } throw new NoSuchElementException("No entry '"+key+"' found, can't replace"); } private List<SettableBeanProperty> properties() { ArrayList<SettableBeanProperty> p = new ArrayList<SettableBeanProperty>(_size); for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if (prop != null) { p.add(prop); } } return p; } /** * Accessor for traversing over all contained properties. */ @Override public Iterator<SettableBeanProperty> iterator() { return properties().iterator(); } /** * Method that will re-create initial insertion-ordering of * properties contained in this map. Note that if properties * have been removed, array may contain nulls; otherwise * it should be consecutive. * * @since 2.1 */ public SettableBeanProperty[] getPropertiesInInsertionOrder() { return _propsInOrder; } // Confining this case insensitivity to this function (and the find method) in case we want to // apply a particular locale to the lower case function. For now, using the default. protected final String getPropertyName(SettableBeanProperty prop) { return _caseInsensitive ? prop.getName().toLowerCase() : prop.getName(); } /** * @since 2.3 */ public SettableBeanProperty find(int index) { // note: will scan the whole area, including primary, secondary and // possible spill-area for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if ((prop != null) && (index == prop.getPropertyIndex())) { return prop; } } return null; } public SettableBeanProperty find(String key) { if (key == null) { throw new IllegalArgumentException("Can not pass null property name"); } if (_caseInsensitive) { key = key.toLowerCase(); } // in

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>lined `_hashCode(key)` int slot = key.hashCode() & _hashMask; // int h = key.hashCode(); // int slot = (h + (h >> 13)) & _hashMask; int ix = (slot<<1); Object match = _hashArea[ix]; if ((match == key) || key.equals(match)) { return (SettableBeanProperty) _hashArea[ix+1]; } return _find2(key, slot, match); } private final SettableBeanProperty _find2(String key, int slot, Object match) { if (match == null) { return null; } // no? secondary? int hashSize = _hashMask+1; int ix = hashSize + (slot>>1) << 1; match = _hashArea[ix]; if (key.equals(match)) { return (SettableBeanProperty) _hashArea[ix+1]; } if (match != null) { // _findFromSpill(...) int i = (hashSize + (hashSize>>1)) << 1; for (int end = i + _spillCount; i < end; i += 2) { match = _hashArea[i]; if ((match == key) || key.equals(match)) { return (SettableBeanProperty) _hashArea[i+1]; } } } return null; } /* /********************************************************** /* Public API /********************************************************** */ public int size() { return _size; } /** * Specialized method for removing specified existing entry. * NOTE: entry MUST exist, otherwise an exception is thrown. */ public void remove(SettableBeanProperty propToRm) { ArrayList<SettableBeanProperty> props = new ArrayList<SettableBeanProperty>(_size); String key = getPropertyName(propToRm); boolean found = false; for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if (prop == null) { continue; } if (!found) { found = key.equals(prop.getName()); if (found) { // need to leave a hole here _propsInOrder[_findFromOrdered(prop)] = null; continue; } } props.add(prop); } if (!found) { throw new NoSuchElementException("No entry '"+propToRm.getName()+"' found, can't remove"); } init(props); } /** * Convenience method that tries to find property with given name, and * if it is found, call {@link SettableBeanProperty#deserializeAndSet} * on it, and return true; or, if not found, return

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> false. * Note, too, that if deserialization is attempted, possible exceptions * are wrapped if and as necessary, so caller need not handle those. * * @since 2.5 */ public boolean findDeserializeAndSet(JsonParser p, DeserializationContext ctxt, Object bean, String key) throws IOException { final SettableBeanProperty prop = find(key); if (prop == null) { return false; } try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, key, ctxt); } return true; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Properties=["); int count = 0; Iterator<SettableBeanProperty> it = iterator(); while (it.hasNext()) { SettableBeanProperty prop = it.next(); if (count++ > 0) { sb.append(", "); } sb.append(prop.getName()); sb.append('('); sb.append(prop.getType()); sb.append(')'); } sb.append(']'); return sb.toString(); } /* /********************************************************** /* Helper methods /********************************************************** */ protected SettableBeanProperty _rename(SettableBeanProperty prop, NameTransformer xf) { if (prop == null) { return prop; } String newName = xf.transform(prop.getName()); prop = prop.withSimpleName(newName); JsonDeserializer<?> deser = prop.getValueDeserializer(); if (deser != null) { @SuppressWarnings("unchecked") JsonDeserializer<Object> newDeser = (JsonDeserializer<Object>) deser.unwrappingDeserializer(xf); if (newDeser != deser) { prop = prop.withValueDeserializer(newDeser); } } return prop; } protected void wrapAndThrow(Throwable t, Object bean, String fieldName, DeserializationContext ctxt) throws IOException { // inlined 'throwOrReturnThrowable' while (t instanceof InvocationTargetException && t.getCause() != null) { t = t.getCause(); } // Errors to be passed as is if (t instanceof Error) { throw (Error) t; } // StackOverflowErrors are tricky ones; need to be careful... boolean wrap = (ctxt == null) || ctxt.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS); // Ditto for IOExceptions; except we may want to wrap JSON exceptions if (t instanceof IOException) { if (!wrap || !(t instanceof JsonProcessingException)) { throw (IOException) t; } } else if (!wrap) { // [JACKSON-407] -- allow disabling wrapping for unchecked exceptions if (t instanceof RuntimeException) { throw (RuntimeException) t; } } throw

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> JsonMappingException.wrapWithPath(t, bean, fieldName); } /** * Helper method used to find exact location of a property with name * given exactly, not subject to case changes, within hash area. * Expectation is that such property SHOULD exist, although no * exception is thrown. * * @since 2.7 */ private final int _findIndexInHash(String key) { final int slot = _hashCode(key); int ix = (slot<<1); // primary match? if (key.equals(_hashArea[ix])) { return ix+1; } // no? secondary? int hashSize = _hashMask+1; ix = hashSize + (slot>>1) << 1; if (key.equals(_hashArea[ix])) { return ix+1; } // perhaps spill then int i = (hashSize + (hashSize>>1)) << 1; for (int end = i + _spillCount; i < end; i += 2) { if (key.equals(_hashArea[i])) { return i+1; } } return -1; } private final int _findFromOrdered(SettableBeanProperty prop) { for (int i = 0, end = _propsInOrder.length; i < end; ++i) { if (_propsInOrder[i] == prop) { return i; } } throw new IllegalStateException("Illegal state: property '"+prop.getName()+"' missing from _propsInOrder"); } // Offlined version for convenience if we want to change hashing scheme private final int _hashCode(String key) { // This method produces better hash, fewer collisions... yet for some // reason produces slightly worse performance. Very strange. // 05-Aug-2015, tatu: ... still true? /* int h = key.hashCode(); return (h + (h >> 13)) & _hashMask; */ return key.hashCode() & _hashMask; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>) { return new short[len]; } } public final static class IntBuilder extends PrimitiveArrayBuilder<int[]> { public IntBuilder() { } @Override public final int[] _constructArray(int len) { return new int[len]; } } public final static class LongBuilder extends PrimitiveArrayBuilder<long[]> { public LongBuilder() { } @Override public final long[] _constructArray(int len) { return new long[len]; } } public final static class FloatBuilder extends PrimitiveArrayBuilder<float[]> { public FloatBuilder() { } @Override public final float[] _constructArray(int len) { return new float[len]; } } public final static class DoubleBuilder extends PrimitiveArrayBuilder<double[]> { public DoubleBuilder() { } @Override public final double[] _constructArray(int len) { return new double[len]; } } /* /********************************************************** /* Static helper methods /********************************************************** */ /** * Helper method used for constructing simple value comparator used for * comparing arrays for content equality. *<p> * Note: current implementation is not optimized for speed; if performance * ever becomes an issue, it is possible to construct much more efficient * typed instances (one for Object[] and sub-types; one per primitive type). * * @since 2.2 Moved from earlier <code>Comparators</code> class */ public static Object getArrayComparator(final Object defaultValue) { final int length = Array.getLength(defaultValue); final Class<?> defaultValueType = defaultValue.getClass(); return new Object() { @Override public boolean equals(Object other) { if (other == this) return true; if (other == null || other.getClass() != defaultValueType) { return false; } if (Array.getLength(other) != length) return false; // so far so good: compare actual equality; but only shallow one for (int i = 0; i < length; ++i) { Object value1 = Array.get(defaultValue, i); Object value2 = Array.get(other, i); if (value1 == value2) continue; if (value1 != null) { if (!value1.equals(value2)) { return false; } } } return true; } }; } public static <T> HashSet<T> arrayToSet(T[] elements) { HashSet<T> result = new HashSet<T>(); if (elements != null) { for (T elem : elements) { result.add(elem); } } return result; } public static <T> ArrayList<T> arrayToList(T[] elements) { ArrayList<T> result = new ArrayList<T>(); if (elements != null) { for (T elem

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser; import java.lang.reflect.Method; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig; import com.fasterxml.jackson.databind.cfg.HandlerInstantiator; import com.fasterxml.jackson.databind.deser.impl.CreatorCollector; import com.fasterxml.jackson.databind.deser.std.*; import com.fasterxml.jackson.databind.ext.OptionalHandlerFactory; import com.fasterxml.jackson.databind.introspect.*; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; import com.fasterxml.jackson.databind.type.*; import com.fasterxml.jackson.databind.util.*; /** * Abstract factory base class that can provide deserializers for standard * JDK classes, including collection classes and simple heuristics for * "upcasting" common collection interface types * (such as {@link java.util.Collection}). *<p> * Since all simple deserializers are eagerly instantiated, and there is * no additional introspection or customizability of these types, * this factory is stateless. */ @SuppressWarnings("serial") public abstract class BasicDeserializerFactory extends DeserializerFactory implements java.io.Serializable { private final static Class<?> CLASS_OBJECT = Object.class; private final static Class<?> CLASS_STRING = String.class; private final static Class<?> CLASS_CHAR_BUFFER = CharSequence.class; private final static Class<?> CLASS_ITERABLE = Iterable.class; private final static Class<?> CLASS_MAP_ENTRY = Map.Entry.class; /** * We need a placeholder for creator properties that don't have name * but are marked with `@JsonWrapped` annotation. */ protected final static PropertyName UNWRAPPED_CREATOR_PARAM_NAME = new PropertyName("@JsonUnwrapped"); /* We do some defaulting for abstract Map classes and * interfaces, to avoid having to use exact types or annotations in * cases where the most common concrete Maps will do. */ @SuppressWarnings("rawtypes") final static HashMap<String, Class<? extends Map>> _mapFallbacks = new HashMap<String, Class<? extends Map>>(); static { _mapFallbacks.put(Map.class.getName(), LinkedHashMap.class); _mapFallbacks.put(ConcurrentMap.class.getName(), ConcurrentHashMap.class); _mapFallbacks.put(SortedMap.class.getName(), TreeMap.class);

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> _mapFallbacks.put(java.util.NavigableMap.class.getName(), TreeMap.class); _mapFallbacks.put(java.util.concurrent.ConcurrentNavigableMap.class.getName(), java.util.concurrent.ConcurrentSkipListMap.class); } /* We do some defaulting for abstract Collection classes and * interfaces, to avoid having to use exact types or annotations in * cases where the most common concrete Collection will do. */ @SuppressWarnings("rawtypes") final static HashMap<String, Class<? extends Collection>> _collectionFallbacks = new HashMap<String, Class<? extends Collection>>(); static { _collectionFallbacks.put(Collection.class.getName(), ArrayList.class); _collectionFallbacks.put(List.class.getName(), ArrayList.class); _collectionFallbacks.put(Set.class.getName(), HashSet.class); _collectionFallbacks.put(SortedSet.class.getName(), TreeSet.class); _collectionFallbacks.put(Queue.class.getName(), LinkedList.class); // then JDK 1.6 types: /* 17-May-2013, tatu: [databind#216] Should be fine to use straight Class references EXCEPT * that some god-forsaken platforms (... looking at you, Android) do not * include these. So, use "soft" references... */ _collectionFallbacks.put("java.util.Deque", LinkedList.class); _collectionFallbacks.put("java.util.NavigableSet", TreeSet.class); } /* /********************************************************** /* Config /********************************************************** */ /** * Configuration settings for this factory; immutable instance (just like this * factory), new version created via copy-constructor (fluent-style) */ protected final DeserializerFactoryConfig _factoryConfig; /* /********************************************************** /* Life cycle /********************************************************** */ protected BasicDeserializerFactory(DeserializerFactoryConfig config) { _factoryConfig = config; } /** * Method for getting current {@link DeserializerFactoryConfig}. *<p> * Note that since instances are immutable, you can NOT change settings * by accessing an instance and calling methods: this will simply create * new instance of config object. */ public DeserializerFactoryConfig getFactoryConfig() { return _factoryConfig; } protected abstract DeserializerFactory withConfig(DeserializerFactoryConfig config); /* /******************************************************** /* Configuration handling: fluent factories /******************************************************** */ /** * Convenience method for creating a new factory instance with additional deserializer * provider. */ @Override public final DeserializerFactory withAdditionalDeserializers(Deserializers additional) { return withConfig(_factoryConfig.withAdditionalDeserializers(additional)); } /** * Convenience method for creating a new factory instance with additional * {@link KeyDeserializers}. */ @Override public final Deserial

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> ctxt, BeanDescription beanDesc) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); ValueInstantiator instantiator = null; // [JACKSON-633] Check @JsonValueInstantiator before anything else AnnotatedClass ac = beanDesc.getClassInfo(); Object instDef = ctxt.getAnnotationIntrospector().findValueInstantiator(ac); if (instDef != null) { instantiator = _valueInstantiatorInstance(config, ac, instDef); } if (instantiator == null) { /* Second: see if some of standard Jackson/JDK types might provide value * instantiators. */ instantiator = _findStdValueInstantiator(config, beanDesc); if (instantiator == null) { instantiator = _constructDefaultValueInstantiator(ctxt, beanDesc); } } // finally: anyone want to modify ValueInstantiator? if (_factoryConfig.hasValueInstantiators()) { for (ValueInstantiators insts : _factoryConfig.valueInstantiators()) { instantiator = insts.findValueInstantiator(config, beanDesc, instantiator); // let's do sanity check; easier to spot buggy handlers if (instantiator == null) { throw JsonMappingException.from(ctxt.getParser(), "Broken registered ValueInstantiators (of type "+insts.getClass().getName()+"): returned null ValueInstantiator"); } } } // Sanity check: does the chosen instantatior have incomplete creators? if (instantiator.getIncompleteParameter() != null) { final AnnotatedParameter nonAnnotatedParam = instantiator.getIncompleteParameter(); final AnnotatedWithParams ctor = nonAnnotatedParam.getOwner(); throw new IllegalArgumentException("Argument #"+nonAnnotatedParam.getIndex()+" of constructor "+ctor+" has no property name annotation; must have name when multiple-parameter constructor annotated as Creator"); } return instantiator; } private ValueInstantiator _findStdValueInstantiator(DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { if (beanDesc.getBeanClass() == JsonLocation.class) { return new JsonLocationInstantiator(); } return null; } /** * Method that will construct standard default {@link ValueInstantiator} * using annotations (like @JsonCreator) and visibility rules */ protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationContext ctxt, BeanDescription beanDesc) throws JsonMappingException { CreatorCollector creators = new CreatorCollector(beanDesc, ctxt.getConfig()); AnnotationIntrospector intr = ctxt.getAnnotationIntrospector(); // need to construct suitable visibility checker: final DeserializationConfig config = ctxt.getConfig(); VisibilityChecker<?> vchecker = config.getDefaultVisibilityChecker(); vchecker = intr.findAutoDetectVisibility(beanDesc.getClassInfo(), vchecker); /* 24-Sep-2014

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>, tatu: Tricky part first; need to merge resolved property information * (which has creator parameters sprinkled around) with actual creator * declarations (which are needed to access creator annotation, amongst other things). * Easiest to combine that info first, then pass it to remaining processing. */ /* 15-Mar-2015, tatu: Alas, this won't help with constructors that only have implicit * names. Those will need to be resolved later on. */ Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorDefs = _findCreatorsFromProperties(ctxt, beanDesc); /* Important: first add factory methods; then constructors, so * latter can override former! */ _addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs); // constructors only usable on concrete types: if (beanDesc.getType().isConcrete()) { _addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs); } return creators.constructValueInstantiator(config); } protected Map<AnnotatedWithParams,BeanPropertyDefinition[]> _findCreatorsFromProperties(DeserializationContext ctxt, BeanDescription beanDesc) throws JsonMappingException { Map<AnnotatedWithParams,BeanPropertyDefinition[]> result = Collections.emptyMap(); for (BeanPropertyDefinition propDef : beanDesc.findProperties()) { Iterator<AnnotatedParameter> it = propDef.getConstructorParameters(); while (it.hasNext()) { AnnotatedParameter param = it.next(); AnnotatedWithParams owner = param.getOwner(); BeanPropertyDefinition[] defs = result.get(owner); final int index = param.getIndex(); if (defs == null) { if (result.isEmpty()) { // since emptyMap is immutable need to create a 'real' one result = new LinkedHashMap<AnnotatedWithParams,BeanPropertyDefinition[]>(); } defs = new BeanPropertyDefinition[owner.getParameterCount()]; result.put(owner, defs); } else { if (defs[index] != null) { throw new IllegalStateException("Conflict: parameter #"+index+" of "+owner +" bound to more than one property; "+defs[index]+" vs "+propDef); } } defs[index] = propDef; } } return result; } public ValueInstantiator _valueInstantiatorInstance(DeserializationConfig config, Annotated annotated, Object instDef) throws JsonMappingException { if (instDef == null) { return null; } ValueInstantiator inst; if (instDef instanceof ValueInstantiator) { return (ValueInstantiator) instDef; } if (!(instDef instanceof Class)) { throw new IllegalStateException("AnnotationIntrospector returned key deserializer definition of type " +instDef.getClass().getName() +"; expected type KeyDeserializer or Class<KeyDeserializer>

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> instead"); } Class<?> instClass = (Class<?>)instDef; if (ClassUtil.isBogusClass(instClass)) { return null; } if (!ValueInstantiator.class.isAssignableFrom(instClass)) { throw new IllegalStateException("AnnotationIntrospector returned Class "+instClass.getName() +"; expected Class<ValueInstantiator>"); } HandlerInstantiator hi = config.getHandlerInstantiator(); if (hi != null) { inst = hi.valueInstantiatorInstance(config, annotated, instClass); if (inst != null) { return inst; } } return (ValueInstantiator) ClassUtil.createInstance(instClass, config.canOverrideAccessModifiers()); } protected void _addDeserializerConstructors (DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams) throws JsonMappingException { // First things first: the "default constructor" (zero-arg // constructor; whether implicit or explicit) is NOT included // in list of constructors, so needs to be handled separately. AnnotatedConstructor defaultCtor = beanDesc.findDefaultConstructor(); if (defaultCtor != null) { if (!creators.hasDefaultCreator() || intr.hasCreatorAnnotation(defaultCtor)) { creators.setDefaultCreator(defaultCtor); } } // may need to keep track for [#725] List<AnnotatedConstructor> implicitCtors = null; for (AnnotatedConstructor ctor : beanDesc.getConstructors()) { final boolean isCreator = intr.hasCreatorAnnotation(ctor); BeanPropertyDefinition[] propDefs = creatorParams.get(ctor); final int argCount = ctor.getParameterCount(); // some single-arg factory methods (String, number) are auto-detected if (argCount == 1) { BeanPropertyDefinition argDef = (propDefs == null) ? null : propDefs[0]; boolean useProps = _checkIfCreatorPropertyBased(intr, ctor, argDef); if (useProps) { SettableBeanProperty[] properties = new SettableBeanProperty[1]; PropertyName name = (argDef == null) ? null : argDef.getFullName(); AnnotatedParameter arg = ctor.getParameter(0); properties[0] = constructCreatorProperty(ctxt, beanDesc, name, 0, arg, intr.findInjectableValueId(arg)); creators.addPropertyCreator(ctor, isCreator, properties); } else { /*boolean added = */ _handleSingleArgumentConstructor(ctxt, beanDesc, vchecker, intr, creators, ctor, isCreator, vchecker.isCreatorVisible(ctor)); // one more thing: sever link to creator property, to avoid possible later // problems with "unresolved" constructor property if (argDef != null

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } // otherwise, epic fail? // 16-Mar-2015, tatu: due to [#725], need to be more permissive. For now let's // only report problem if there's no implicit name PropertyName impl = _findImplicitParamName(nonAnnotatedParam, intr); if (impl == null || impl.isEmpty()) { // Let's consider non-static inner class as a special case... int ix = nonAnnotatedParam.getIndex(); if ((ix == 0) && ClassUtil.isNonStaticInnerClass(ctor.getDeclaringClass())) { throw new IllegalArgumentException("Non-static inner classes like " +ctor.getDeclaringClass().getName()+" can not use @JsonCreator for constructors"); } throw new IllegalArgumentException("Argument #"+ix +" of constructor "+ctor+" has no property name annotation; must have name when multiple-parameter constructor annotated as Creator"); } } // [#725]: as a fallback, all-implicit names may work as well if (!creators.hasDefaultCreator()) { if (implicitCtors == null) { implicitCtors = new LinkedList<AnnotatedConstructor>(); } implicitCtors.add(ctor); } } // last option, as per [#725]: consider implicit-names-only, visible constructor, // if just one found if ((implicitCtors != null) && !creators.hasDelegatingCreator() && !creators.hasPropertyBasedCreator()) { _checkImplicitlyNamedConstructors(ctxt, beanDesc, vchecker, intr, creators, implicitCtors); } } protected void _checkImplicitlyNamedConstructors(DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, List<AnnotatedConstructor> implicitCtors) throws JsonMappingException { AnnotatedConstructor found = null; SettableBeanProperty[] foundProps = null; // Further checks: (a) must have names for all parameters, (b) only one visible // Also, since earlier matching of properties and creators relied on existence of // `@JsonCreator` (or equivalent) annotation, we need to do bit more re-inspection... main_loop: for (AnnotatedConstructor ctor : implicitCtors) { if (!vchecker.isCreatorVisible(ctor)) { continue; } // as per earlier notes, only end up here if no properties associated with creator final int argCount = ctor.getParameterCount(); SettableBeanProperty[] properties = new SettableBeanProperty[argCount]; for (int i = 0; i < argCount; ++i) { final AnnotatedParameter param = ctor.getParameter(i); final PropertyName name = _findParamName(param, intr); // must have name (implicit fine) if (name == null || name.isEmpty()) { continue main

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>_loop; } properties[i] = constructCreatorProperty(ctxt, beanDesc, name, param.getIndex(), param, /*injectId*/ null); } if (found != null) { // only one allowed found = null; break; } found = ctor; foundProps = properties; } // found one and only one visible? Ship it! if (found != null) { creators.addPropertyCreator(found, /*isCreator*/ false, foundProps); BasicBeanDescription bbd = (BasicBeanDescription) beanDesc; // Also: add properties, to keep error messages complete wrt known properties... for (SettableBeanProperty prop : foundProps) { PropertyName pn = prop.getFullName(); if (!bbd.hasProperty(pn)) { BeanPropertyDefinition newDef = SimpleBeanPropertyDefinition.construct( ctxt.getConfig(), prop.getMember(), pn); bbd.addProperty(newDef); } } } } protected boolean _checkIfCreatorPropertyBased(AnnotationIntrospector intr, AnnotatedWithParams creator, BeanPropertyDefinition propDef) { JsonCreator.Mode mode = intr.findCreatorBinding(creator); if (mode == JsonCreator.Mode.PROPERTIES) { return true; } if (mode == JsonCreator.Mode.DELEGATING) { return false; } // If explicit name, or inject id, property-based if (((propDef != null) && propDef.isExplicitlyNamed()) || (intr.findInjectableValueId(creator.getParameter(0)) != null)) { return true; } if (propDef != null) { // One more thing: if implicit name matches property with a getter // or field, we'll consider it property-based as well String implName = propDef.getName(); if (implName != null && !implName.isEmpty()) { if (propDef.couldSerialize()) { return true; } } } // in absence of everything else, default to delegating return false; } protected boolean _handleSingleArgumentConstructor(DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, AnnotatedConstructor ctor, boolean isCreator, boolean isVisible) throws JsonMappingException { // otherwise either 'simple' number, String, or general delegate: Class<?> type = ctor.getRawParameterType(0); if (type == String.class || type == CharSequence.class) { if (isCreator || isVisible) { creators.addStringCreator(ctor, isCreator); } return true; } if (type == int.class || type == Integer.class) { if (isCreator || isVisible) { creators.addIntCreator(ctor, isCreator); } return true; } if (type == long

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>izationConfig config) { Class<?> collectionClass = type.getRawClass(); collectionClass = _collectionFallbacks.get(collectionClass.getName()); if (collectionClass == null) { return null; } return (CollectionType) config.constructSpecializedType(type, collectionClass); } // Copied almost verbatim from "createCollectionDeserializer" -- should try to share more code @Override public JsonDeserializer<?> createCollectionLikeDeserializer(DeserializationContext ctxt, CollectionLikeType type, final BeanDescription beanDesc) throws JsonMappingException { JavaType contentType = type.getContentType(); // Very first thing: is deserializer hard-coded for elements? JsonDeserializer<Object> contentDeser = contentType.getValueHandler(); final DeserializationConfig config = ctxt.getConfig(); // Then optional type info (1.5): if type has been resolved, we may already know type deserializer: TypeDeserializer contentTypeDeser = contentType.getTypeHandler(); // but if not, may still be possible to find: if (contentTypeDeser == null) { contentTypeDeser = findTypeDeserializer(config, contentType); } JsonDeserializer<?> deser = _findCustomCollectionLikeDeserializer(type, config, beanDesc, contentTypeDeser, contentDeser); if (deser != null) { // and then new with 2.2: ability to post-process it too (Issue#120) if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { deser = mod.modifyCollectionLikeDeserializer(config, type, beanDesc, deser); } } } return deser; } /* /********************************************************** /* JsonDeserializerFactory impl: Map(-like) deserializers /********************************************************** */ @Override public JsonDeserializer<?> createMapDeserializer(DeserializationContext ctxt, MapType type, BeanDescription beanDesc) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); JavaType keyType = type.getKeyType(); JavaType contentType = type.getContentType(); // First: is there annotation-specified deserializer for values? @SuppressWarnings("unchecked") JsonDeserializer<Object> contentDeser = (JsonDeserializer<Object>) contentType.getValueHandler(); // Ok: need a key deserializer (null indicates 'default' here) KeyDeserializer keyDes = (KeyDeserializer) keyType.getValueHandler(); // Then optional type info (1.5); either attached to type, or resolved separately: TypeDeserializer contentTypeDeser = contentType.getTypeHandler(); // but if not, may still be possible to find: if (contentTypeDeser == null) { contentTypeDeser = findTypeDeserializer(config, contentType); } // 23-Nov-2010, tatu: Custom deserializer? JsonDeserializer<?> deser = _findCustomMapDeserializer(type, config, beanDesc,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> keyDes, contentTypeDeser, contentDeser); if (deser == null) { // Value handling is identical for all, but EnumMap requires special handling for keys Class<?> mapClass = type.getRawClass(); if (EnumMap.class.isAssignableFrom(mapClass)) { Class<?> kt = keyType.getRawClass(); if (kt == null || !kt.isEnum()) { throw new IllegalArgumentException("Can not construct EnumMap; generic (key) type not available"); } deser = new EnumMapDeserializer(type, null, contentDeser, contentTypeDeser); } // Otherwise, generic handler works ok. /* But there is one more twist: if we are being asked to instantiate * an interface or abstract Map, we need to either find something * that implements the thing, or give up. * * Note that we do NOT try to guess based on secondary interfaces * here; that would probably not work correctly since casts would * fail later on (as the primary type is not the interface we'd * be implementing) */ if (deser == null) { if (type.isInterface() || type.isAbstract()) { @SuppressWarnings("rawtypes") Class<? extends Map> fallback = _mapFallbacks.get(mapClass.getName()); if (fallback != null) { mapClass = fallback; type = (MapType) config.constructSpecializedType(type, mapClass); // But if so, also need to re-check creators... beanDesc = config.introspectForCreation(type); } else { // [Issue#292]: Actually, may be fine, but only if polymorphich deser enabled if (type.getTypeHandler() == null) { throw new IllegalArgumentException("Can not find a deserializer for non-concrete Map type "+type); } deser = AbstractDeserializer.constructForNonPOJO(beanDesc); } } if (deser == null) { ValueInstantiator inst = findValueInstantiator(ctxt, beanDesc); MapDeserializer md = new MapDeserializer(type, inst, keyDes, contentDeser, contentTypeDeser); AnnotationIntrospector ai = config.getAnnotationIntrospector(); md.setIgnorableProperties(ai.findPropertiesToIgnore(beanDesc.getClassInfo(), false)); deser = md; } } } // and then new with 2.2: ability to post-process it too (Issue#120) if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { deser = mod.modifyMapDeserializer(config, type, beanDesc, deser); } } return deser; } // Copied almost verbatim from "createMapDeserializer" -- should try to share more code @Override public JsonDeserializer<?> createMapLikeDeserializer(DeserializationContext ctxt, MapLikeType

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> break; } } throw new IllegalArgumentException("Unsuitable method ("+factory+") decorated with @JsonCreator (for Enum type " +enumClass.getName()+")"); } } // Need to consider @JsonValue if one found if (deser == null) { deser = new EnumDeserializer(constructEnumResolver(enumClass, config, beanDesc.findJsonValueMethod())); } } // and then post-process it too if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { deser = mod.modifyEnumDeserializer(config, type, beanDesc, deser); } } return deser; } @Override public JsonDeserializer<?> createTreeDeserializer(DeserializationConfig config, JavaType nodeType, BeanDescription beanDesc) throws JsonMappingException { @SuppressWarnings("unchecked") Class<? extends JsonNode> nodeClass = (Class<? extends JsonNode>) nodeType.getRawClass(); // 23-Nov-2010, tatu: Custom deserializer? JsonDeserializer<?> custom = _findCustomTreeNodeDeserializer(nodeClass, config, beanDesc); if (custom != null) { return custom; } return JsonNodeDeserializer.getDeserializer(nodeClass); } @Override public JsonDeserializer<?> createReferenceDeserializer(DeserializationContext ctxt, ReferenceType type, BeanDescription beanDesc) throws JsonMappingException { JavaType contentType = type.getContentType(); // Very first thing: is deserializer hard-coded for elements? JsonDeserializer<Object> contentDeser = contentType.getValueHandler(); final DeserializationConfig config = ctxt.getConfig(); // Then optional type info: if type has been resolved, we may already know type deserializer: TypeDeserializer contentTypeDeser = contentType.getTypeHandler(); if (contentTypeDeser == null) { // or if not, may be able to find: contentTypeDeser = findTypeDeserializer(config, contentType); } JsonDeserializer<?> deser = _findCustomReferenceDeserializer(type, config, beanDesc, contentTypeDeser, contentDeser); if (deser == null) { // Just one referential type as of JDK 1.7 / Java 7: AtomicReference (Java 8 adds Optional) if (AtomicReference.class.isAssignableFrom(type.getRawClass())) { // 19-Apr-2016, tatu: By default we'd get something that expect to see an // AtomicReference... but what we need is something else, so... return new AtomicReferenceDeserializer(contentType, contentTypeDeser, contentDeser); } } if (deser != null) { // and then post-process if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { deser = mod.modifyReferenceDeserializer(config, type, beanDesc, deser); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> " +enumClass.getName()+")"); } } // [JACKSON-749] Also, need to consider @JsonValue, if one found return StdKeyDeserializers.constructEnumKeyDeserializer(enumRes); } /* /********************************************************** /* Extended API /********************************************************** */ /** * Method called to create a type information deserializer for values of * given non-container property, if one is needed. * If not needed (no polymorphic handling configured for property), should return null. *<p> * Note that this method is only called for non-container bean properties, * and not for values in container types or root values (or container properties) * * @param baseType Declared base type of the value to deserializer (actual * deserializer type will be this type or its subtype) * * @return Type deserializer to use for given base type, if one is needed; null if not. */ public TypeDeserializer findPropertyTypeDeserializer(DeserializationConfig config, JavaType baseType, AnnotatedMember annotated) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, annotated, baseType); // Defaulting: if no annotations on member, check value class if (b == null) { return findTypeDeserializer(config, baseType); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByTypeId( config, annotated, baseType); return b.buildTypeDeserializer(config, baseType, subtypes); } /** * Method called to find and create a type information deserializer for values of * given container (list, array, map) property, if one is needed. * If not needed (no polymorphic handling configured for property), should return null. *<p> * Note that this method is only called for container bean properties, * and not for values in container types or root values (or non-container properties) * * @param containerType Type of property; must be a container type * @param propertyEntity Field or method that contains container property */ public TypeDeserializer findPropertyContentTypeDeserializer(DeserializationConfig config, JavaType containerType, AnnotatedMember propertyEntity) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, propertyEntity, containerType); JavaType contentType = containerType.getContentType(); // Defaulting: if no annotations on member, check class if (b == null) { return findTypeDeserializer(config, contentType); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSub

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>typesByTypeId( config, propertyEntity, contentType); return b.buildTypeDeserializer(config, contentType, subtypes); } /** * Helper method called to find one of default serializers for "well-known" * platform types: JDK-provided types, and small number of public Jackson * API types. * * @since 2.2 */ public JsonDeserializer<?> findDefaultDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException { Class<?> rawType = type.getRawClass(); // Object ("untyped"), String equivalents: if (rawType == CLASS_OBJECT) { // 11-Feb-2015, tatu: As per [databind#700] need to be careful wrt non-default Map, List. DeserializationConfig config = ctxt.getConfig(); JavaType lt, mt; if (_factoryConfig.hasAbstractTypeResolvers()) { lt = _findRemappedType(config, List.class); mt = _findRemappedType(config, Map.class); } else { lt = mt = null; } return new UntypedObjectDeserializer(lt, mt); } if (rawType == CLASS_STRING || rawType == CLASS_CHAR_BUFFER) { return StringDeserializer.instance; } if (rawType == CLASS_ITERABLE) { // [Issue#199]: Can and should 'upgrade' to a Collection type: TypeFactory tf = ctxt.getTypeFactory(); JavaType[] tps = tf.findTypeParameters(type, CLASS_ITERABLE); JavaType elemType = (tps == null || tps.length != 1) ? TypeFactory.unknownType() : tps[0]; CollectionType ct = tf.constructCollectionType(Collection.class, elemType); // Should we re-introspect beanDesc? For now let's not... return createCollectionDeserializer(ctxt, ct, beanDesc); } if (rawType == CLASS_MAP_ENTRY) { // 28-Apr-2015, tatu: TypeFactory does it all for us already so JavaType kt = type.containedType(0); if (kt == null) { kt = TypeFactory.unknownType(); } JavaType vt = type.containedType(1); if (vt == null) { vt = TypeFactory.unknownType(); } TypeDeserializer vts = (TypeDeserializer) vt.getTypeHandler(); if (vts == null) { vts = findTypeDeserializer(ctxt.getConfig(), vt); } JsonDeserializer<Object> valueDeser = vt.getValueHandler(); KeyDeserializer keyDes = (KeyDeserializer) kt.getValueHandler(); return new MapEntryDeserializer(type, keyDes, valueDeser, vts); } String clsName = rawType.getName(); if (

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> /* Extended API /********************************************************** */ /** * Method that can be used to access the POJO this node wraps. */ public Object getPojo() { return _value; } /* /********************************************************** /* Overridden standard methods /********************************************************** */ @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof POJONode) { return _pojoEquals((POJONode) o); } return false; } /** * @since 2.3 */ protected boolean _pojoEquals(POJONode other) { if (_value == null) { return other._value == null; } return _value.equals(other._value); } @Override public int hashCode() { return _value.hashCode(); } @Override public String toString() { // [databind#743]: Let's try indicating content type, for debugging purposes if (_value instanceof byte[]) { return String.format("(binary value of %d bytes)", ((byte[]) _value).length); } if (_value instanceof RawValue) { return String.format("(raw value '%s')", ((RawValue) _value).toString()); } return String.valueOf(_value); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.util.Iterator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.Named; /** * Simple value classes that contain definitions of properties, * used during introspection of properties to use for * serialization and deserialization purposes. * These instances are created before actual {@link BeanProperty} * instances are created, i.e. they are used earlier in the process * flow, and are typically use to construct actual * {@link BeanProperty} instances. */ public abstract class BeanPropertyDefinition implements Named { protected final static JsonInclude.Value EMPTY_INCLUDE = JsonInclude.Value.empty(); /* /********************************************************** /* Fluent factory methods for creating modified copies /********************************************************** */ /** * Method that can be used to create a definition with * same settings as this one, but with different * (external) name; that is, one for which * {@link #getName()} would return <code>newName</code>. * * @since 2.3 */ public abstract BeanPropertyDefinition withName(PropertyName newName); /** * Alternate "mutant factory" that will only change simple name, but * leave other optional parts (like namespace) as is. * * @since 2.3 */ public abstract BeanPropertyDefinition withSimpleName(String newSimpleName); /* /********************************************************** /* Basic property information, name, type /********************************************************** */ /** * Accessor for name used for external representation (in JSON). */ @Override // from Named public abstract String getName(); public abstract PropertyName getFullName(); /** * @since 2.6 */ public boolean hasName(PropertyName name) { return getFullName().equals(name); } /** * Accessor that can be used to determine implicit name from underlying * element(s) before possible renaming. This is the "internal" * name derived from accessor ("x" from "getX"), and is not based on * annotations or naming strategy. */ public abstract String getInternalName(); /** * Accessor for finding wrapper name to use for property (if any). * * @since 2.2 */ public abstract PropertyName getWrapperName(); /** * Method for accessing additional metadata. * NOTE: will never return null, so de-referencing return value * is safe. * * @since 2.3 */ public abstract PropertyMetadata getMetadata(); /** * Accessor that can be called to check whether property was included * due to an explicit marker (usually annotation), or just by naming * convention. * * @return True if property was explicitly included (usually by having

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * one of components being annotated); false if inclusion was purely * due to naming or visibility definitions (that is, implicit) */ public abstract boolean isExplicitlyIncluded(); /** * Accessor that can be called to check whether property name was * due to an explicit marker (usually annotation), or just by naming * convention or use of "use-default-name" marker (annotation). *<p> * Note that entries that return true from this method will always * return true for {@link #isExplicitlyIncluded()}, but not necessarily * vice versa. * * @since 2.4 */ public boolean isExplicitlyNamed() { return isExplicitlyIncluded(); } /* /********************************************************** /* Capabilities /********************************************************** */ public boolean couldDeserialize() { return getMutator() != null; } public boolean couldSerialize() { return getAccessor() != null; } /* /********************************************************** /* Access to accessors (fields, methods etc) /********************************************************** */ public abstract boolean hasGetter(); public abstract boolean hasSetter(); public abstract boolean hasField(); public abstract boolean hasConstructorParameter(); public abstract AnnotatedMethod getGetter(); public abstract AnnotatedMethod getSetter(); public abstract AnnotatedField getField(); public abstract AnnotatedParameter getConstructorParameter(); /** * Additional method that may be called instead of {@link #getConstructorParameter()} * to get access to all constructor parameters, not just the highest priority one. * * @since 2.5 */ public Iterator<AnnotatedParameter> getConstructorParameters() { return ClassUtil.emptyIterator(); } /** * Method used to find accessor (getter, field to access) to use for accessing * value of the property. * Null if no such member exists. */ public abstract AnnotatedMember getAccessor(); /** * Method used to find mutator (constructor parameter, setter, field) to use for * changing value of the property. * Null if no such member exists. */ public abstract AnnotatedMember getMutator(); /** * @since 2.3 */ public abstract AnnotatedMember getNonConstructorMutator(); /** * Method used to find the property member (getter, setter, field) that has * the highest precedence in current context (getter method when serializing, * if available, and so forth), if any. *<p> * Note: abstract since 2.5 * * @since 2.1 */ public abstract AnnotatedMember getPrimaryMember(); /* /********************************************************** /* More refined access to configuration features /* (usually based on annotations) /* Since most trivial implementations do not support /* these methods, they are implemented as no-ops. /********************************************************** */ /** * Method used to find View-inclusion definitions for the property. */ public Class<?>[] findViews

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>, unwrapper); } @Override public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) { return new BeanSerializer(this, objectIdWriter, _propertyFilterId); } @Override public BeanSerializerBase withFilterId(Object filterId) { return new BeanSerializer(this, _objectIdWriter, filterId); } @Override protected BeanSerializerBase withIgnorals(String[] toIgnore) { return new BeanSerializer(this, toIgnore); } /** * Implementation has to check whether as-array serialization * is possible reliably; if (and only if) so, will construct * a {@link BeanAsArraySerializer}, otherwise will return this * serializer as is. */ @Override protected BeanSerializerBase asArraySerializer() { /* Can not: * * - have Object Id (may be allowed in future) * - have "any getter" * - have per-property filters */ if ((_objectIdWriter == null) && (_anyGetterWriter == null) && (_propertyFilterId == null) ) { return new BeanAsArraySerializer(this); } // already is one, so: return this; } /* /********************************************************** /* JsonSerializer implementation that differs between impls /********************************************************** */ /** * Main serialization method that will delegate actual output to * configured * {@link BeanPropertyWriter} instances. */ @Override public final void serialize(Object bean, JsonGenerator gen, SerializerProvider provider) throws IOException { if (_objectIdWriter != null) { gen.setCurrentValue(bean); // [databind#631] _serializeWithObjectId(bean, gen, provider, true); return; } gen.writeStartObject(); // [databind#631]: Assign current value, to be accessible by custom serializers gen.setCurrentValue(bean); if (_propertyFilterId != null) { serializeFieldsFiltered(bean, gen, provider); } else { serializeFields(bean, gen, provider); } gen.writeEndObject(); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { return "BeanSerializer for "+handledType().getName(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.type; import java.util.ArrayList; import com.fasterxml.jackson.databind.JavaType; /** * Simple helper class used to keep track of 'call stack' for classes being referenced * (as well as unbound variables) * * @since 2.7 */ public final class ClassStack { protected final ClassStack _parent; protected final Class<?> _current; private ArrayList<ResolvedRecursiveType> _selfRefs; public ClassStack(Class<?> rootType) { this(null, rootType); } private ClassStack(ClassStack parent, Class<?> curr) { _parent = parent; _current = curr; } /** * @return New stack frame, if addition is ok; null if not */ public ClassStack child(Class<?> cls) { return new ClassStack(this, cls); } /** * Method called to indicate that there is a self-reference from * deeper down in stack pointing into type this stack frame represents. */ public void addSelfReference(ResolvedRecursiveType ref) { if (_selfRefs == null) { _selfRefs = new ArrayList<ResolvedRecursiveType>(); } _selfRefs.add(ref); } /** * Method called when type that this stack frame represents is * fully resolved, allowing self-references to be completed * (if there are any) */ public void resolveSelfReferences(JavaType resolved) { if (_selfRefs != null) { for (ResolvedRecursiveType ref : _selfRefs) { ref.setReference(resolved); } } } public ClassStack find(Class<?> cls) { if (_current == cls) return this; for (ClassStack curr = _parent; curr != null; curr = curr._parent) { if (curr._current == cls) { return curr; } } return null; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ClassStack (self-refs: ") .append((_selfRefs == null) ? "0" : String.valueOf(_selfRefs.size())) .append(')') ; for (ClassStack curr = this; curr != null; curr = curr._parent) { sb.append(' ').append(curr._current.getName()); } sb.append(']'); return sb.toString(); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(propName)) { continue; } // regular property? needs buffering SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { buffer.bufferProperty(prop, _deserializeWithErrorWrapping(p, ctxt, prop)); continue; } // As per [JACKSON-313], things marked as ignorable should not be // passed to any setter if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(p, ctxt, handledType(), propName); continue; } // "any property"? if (_anySetter != null) { try { buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); } continue; } // Ok then, let's collect the whole field; name and value if (unknown == null) { unknown = new TokenBuffer(p, ctxt); } unknown.writeFieldName(propName); unknown.copyCurrentStructure(p); } // We hit END_OBJECT, so: Object bean; try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapInstantiationProblem(e, ctxt); bean = null; // never gets here } if (unknown != null) { // polymorphic? if (bean.getClass() != _beanType.getRawClass()) { return handlePolymorphic(null, ctxt, bean, unknown); } // no, just some extra unknown properties return handleUnknownProperties(ctxt, bean, unknown); } return bean; } protected final Object _deserializeWithErrorWrapping(JsonParser p, DeserializationContext ctxt, SettableBeanProperty prop) throws IOException { try { return prop.deserialize(p, ctxt); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), prop.getName(), ctxt); // never gets here, unless caller declines to throw an exception return null; } } /** * Helper method called for rare case of pointing to {@link JsonToken#VALUE_NULL} * token. While this is most often an erroneous condition, there is one specific * case with XML handling where polymorphic type with no properties is exposed * as such, and should be handled same as empty Object. * * @since 2.7 */ protected Object deserializeFromNull(JsonParser p, DeserializationContext ctxt) throws IOException { // 17-Dec-2015, tatu: Highly specialized case, mainly to support polymorphic // "empty" POJOs deserialized from XML, where empty XML tag synthesizes a // `VALUE_

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>clusion = config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION); _caseInsensitivePropertyComparison = config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); } /** * Copy constructor for sub-classes to use, when constructing * custom builder instances */ protected BeanDeserializerBuilder(BeanDeserializerBuilder src) { _beanDesc = src._beanDesc; _defaultViewInclusion = src._defaultViewInclusion; _caseInsensitivePropertyComparison = src._caseInsensitivePropertyComparison; // let's make copy of properties _properties.putAll(src._properties); _injectables = _copy(src._injectables); _backRefProperties = _copy(src._backRefProperties); // Hmmh. Should we create defensive copies here? For now, not yet _ignorableProps = src._ignorableProps; _valueInstantiator = src._valueInstantiator; _objectIdReader = src._objectIdReader; _anySetter = src._anySetter; _ignoreAllUnknown = src._ignoreAllUnknown; _buildMethod = src._buildMethod; _builderConfig = src._builderConfig; } private static HashMap<String, SettableBeanProperty> _copy(HashMap<String, SettableBeanProperty> src) { return (src == null) ? null : new HashMap<String, SettableBeanProperty>(src); } private static <T> List<T> _copy(List<T> src) { return (src == null) ? null : new ArrayList<T>(src); } /* /********************************************************** /* Life-cycle: state modification (adders, setters) /********************************************************** */ /** * Method for adding a new property or replacing a property. */ public void addOrReplaceProperty(SettableBeanProperty prop, boolean allowOverride) { _properties.put(prop.getName(), prop); } /** * Method to add a property setter. Will ensure that there is no * unexpected override; if one is found will throw a * {@link IllegalArgumentException}. */ public void addProperty(SettableBeanProperty prop) { SettableBeanProperty old = _properties.put(prop.getName(), prop); if (old != null && old != prop) { // should never occur... throw new IllegalArgumentException("Duplicate property '"+prop.getName()+"' for "+_beanDesc.getType()); } } /** * Method called to add a property that represents so-called back reference; * reference that "points back" to object that has forward reference to * currently built bean. */ public void addBackReferenceProperty(String referenceName, SettableBeanProperty prop) { if (_backRefProperties == null) { _backRefProperties = new HashMap<String, SettableBeanProperty>(4); } _backRefProperties.put(referenceName,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> prop); // also: if we had property with same name, actually remove it if (_properties != null) { _properties.remove(prop.getName()); } // ??? 23-Jul-2012, tatu: Should it be included in list of all properties? // For now, won't add, since it is inferred, not explicit... } public void addInjectable(PropertyName propName, JavaType propType, Annotations contextAnnotations, AnnotatedMember member, Object valueId) { if (_injectables == null) { _injectables = new ArrayList<ValueInjector>(); } _injectables.add(new ValueInjector(propName, propType, contextAnnotations, member, valueId)); } /** * Method that will add property name as one of properties that can * be ignored if not recognized. */ public void addIgnorable(String propName) { if (_ignorableProps == null) { _ignorableProps = new HashSet<String>(); } _ignorableProps.add(propName); } /** * Method called by deserializer factory, when a "creator property" * (something that is passed via constructor- or factory method argument; * instead of setter or field). *<p> * Default implementation does not do anything; we may need to revisit this * decision if these properties need to be available through accessors. * For now, however, we just have to ensure that we don't try to resolve * types that masked setter/field has (see [JACKSON-700] for details). */ public void addCreatorProperty(SettableBeanProperty prop) { addProperty(prop); } public void setAnySetter(SettableAnyProperty s) { if (_anySetter != null && s != null) { throw new IllegalStateException("_anySetter already set to non-null"); } _anySetter = s; } public void setIgnoreUnknownProperties(boolean ignore) { _ignoreAllUnknown = ignore; } public void setValueInstantiator(ValueInstantiator inst) { _valueInstantiator = inst; } public void setObjectIdReader(ObjectIdReader r) { _objectIdReader = r; } public void setPOJOBuilder(AnnotatedMethod buildMethod, JsonPOJOBuilder.Value config) { _buildMethod = buildMethod; _builderConfig = config; } /* /********************************************************** /* Public accessors /********************************************************** */ /** * Method that allows accessing all properties that this * builder currently contains. *<p> * Note that properties are returned in order that properties * are ordered (explictly, or by rule), which is the serialization * order. */ public Iterator<SettableBeanProperty> getProperties() { return _properties.values().iterator(); } public SettableBeanProperty findProperty

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> * additional external Builder object during data binding. */ public JsonDeserializer<?> buildBuilderBased(JavaType valueType, String expBuildMethodName) { // First: validation; must have build method that returns compatible type if (_buildMethod == null) { // as per [databind#777], allow empty name if (!expBuildMethodName.isEmpty()) { throw new IllegalArgumentException("Builder class "+_beanDesc.getBeanClass().getName() +" does not have build method (name: '"+expBuildMethodName+"')"); } } else { // also: type of the method must be compatible Class<?> rawBuildType = _buildMethod.getRawReturnType(); Class<?> rawValueType = valueType.getRawClass(); if ((rawBuildType != rawValueType) && !rawBuildType.isAssignableFrom(rawValueType) && !rawValueType.isAssignableFrom(rawBuildType)) { throw new IllegalArgumentException("Build method '"+_buildMethod.getFullName() +" has bad return type ("+rawBuildType.getName() +"), not compatible with POJO type ("+valueType.getRawClass().getName()+")"); } } // And if so, we can try building the deserializer Collection<SettableBeanProperty> props = _properties.values(); BeanPropertyMap propertyMap = BeanPropertyMap.construct(props, _caseInsensitivePropertyComparison); propertyMap.assignIndexes(); boolean anyViews = !_defaultViewInclusion; if (!anyViews) { for (SettableBeanProperty prop : props) { if (prop.hasViews()) { anyViews = true; break; } } } if (_objectIdReader != null) { /* 18-Nov-2012, tatu: May or may not have annotations for id property; * but no easy access. But hard to see id property being optional, * so let's consider required at this point. */ ObjectIdValueProperty prop = new ObjectIdValueProperty(_objectIdReader, PropertyMetadata.STD_REQUIRED); propertyMap = propertyMap.withProperty(prop); } return new BuilderBasedDeserializer(this, _beanDesc, propertyMap, _backRefProperties, _ignorableProps, _ignoreAllUnknown, anyViews); } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.reflect.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.util.ClassUtil; public final class AnnotatedConstructor extends AnnotatedWithParams { private static final long serialVersionUID = 1L; protected final Constructor<?> _constructor; /** * Field that is used to make JDK serialization work with this * object. * * @since 2.1 */ protected Serialization _serialization; /* /********************************************************** /* Life-cycle /********************************************************** */ public AnnotatedConstructor(TypeResolutionContext ctxt, Constructor<?> constructor, AnnotationMap classAnn, AnnotationMap[] paramAnn) { super(ctxt, classAnn, paramAnn); if (constructor == null) { throw new IllegalArgumentException("Null constructor not allowed"); } _constructor = constructor; } /** * Method used for JDK serialization support * @since 2.1 */ protected AnnotatedConstructor(Serialization ser) { super(null, null, null); _constructor = null; _serialization = ser; } @Override public AnnotatedConstructor withAnnotations(AnnotationMap ann) { return new AnnotatedConstructor(_typeContext, _constructor, ann, _paramAnnotations); } /* /********************************************************** /* Annotated impl /********************************************************** */ @Override public Constructor<?> getAnnotated() { return _constructor; } @Override public int getModifiers() { return _constructor.getModifiers(); } @Override public String getName() { return _constructor.getName(); } @Override public JavaType getType() { return _typeContext.resolveType(getRawType()); } @Override public Class<?> getRawType() { return _constructor.getDeclaringClass(); } /* /********************************************************** /* Extended API /********************************************************** */ @Override public int getParameterCount() { return _constructor.getParameterTypes().length; } @Override public Class<?> getRawParameterType(int index) { Class<?>[] types = _constructor.getParameterTypes(); return (index >= types.length) ? null : types[index]; } @Override public JavaType getParameterType(int index) { Type[] types = _constructor.getGenericParameterTypes(); if (index >= types.length) { return null; } return _typeContext.resolveType(types[index]); } @Override @Deprecated // since 2.7 public Type getGenericParameterType(int index) { Type[] types = _constructor.getGenericParameterTypes(); if (index >= types.length) { return null; } return types[index]; } @Override public final Object call() throws Exception { return _constructor.newInstance(); } @Override public final Object call(Object[] args

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>) throws Exception { return _constructor.newInstance(args); } @Override public final Object call1(Object arg) throws Exception { return _constructor.newInstance(arg); } /* /********************************************************** /* AnnotatedMember impl /********************************************************** */ @Override public Class<?> getDeclaringClass() { return _constructor.getDeclaringClass(); } @Override public Member getMember() { return _constructor; } @Override public void setValue(Object pojo, Object value) throws UnsupportedOperationException { throw new UnsupportedOperationException("Cannot call setValue() on constructor of " +getDeclaringClass().getName()); } @Override public Object getValue(Object pojo) throws UnsupportedOperationException { throw new UnsupportedOperationException("Cannot call getValue() on constructor of " +getDeclaringClass().getName()); } /* /********************************************************** /* Extended API, specific annotations /********************************************************** */ @Override public String toString() { return "[constructor for "+getName()+", annotations: "+_annotations+"]"; } @Override public int hashCode() { return _constructor.getName().hashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; return ((AnnotatedConstructor) o)._constructor == _constructor; } /* /********************************************************** /* JDK serialization handling /********************************************************** */ Object writeReplace() { return new AnnotatedConstructor(new Serialization(_constructor)); } Object readResolve() { Class<?> clazz = _serialization.clazz; try { Constructor<?> ctor = clazz.getDeclaredConstructor(_serialization.args); // 06-Oct-2012, tatu: Has "lost" its security override, must force back if (!ctor.isAccessible()) { ClassUtil.checkAndFixAccess(ctor, false); } return new AnnotatedConstructor(null, ctor, null, null); } catch (Exception e) { throw new IllegalArgumentException("Could not find constructor with " +_serialization.args.length+" args from Class '"+clazz.getName()); } } /** * Helper class that is used as the workaround to persist * Field references. It basically just stores declaring class * and field name. */ private final static class Serialization implements java.io.Serializable { private static final long serialVersionUID = 1L; protected Class<?> clazz; protected Class<?>[] args; public Serialization(Constructor<?> ctor) { clazz = ctor.getDeclaringClass(); args = ctor.getParameterTypes(); } } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> that * passes specified {@link FormatSchema} to {@link JsonParser} that * is constructed for parsing content. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader with(FormatSchema schema) { if (_schema == schema) { return this; } _verifySchemaType(schema); return _new(this, _config, _valueType, _rootDeserializer, _valueToUpdate, schema, _injectableValues, _dataFormatReaders); } /** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(JavaType valueType) { if (valueType != null && valueType.equals(_valueType)) { return this; } JsonDeserializer<Object> rootDeser = _prefetchRootDeserializer(valueType); // type is stored here, no need to make a copy of config DataFormatReaders det = _dataFormatReaders; if (det != null) { det = det.withType(valueType); } return _new(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); } /** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(Class<?> valueType) { return forType(_config.constructType(valueType)); } /** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(TypeReference<?> valueTypeRef) { return forType(_config.getTypeFactory().constructType(valueTypeRef.getType())); } /** * @deprecated since 2.5 Use {@link #forType(JavaType)} instead */ @Deprecated public ObjectReader withType(JavaType valueType) { return forType(valueType); } /** * @deprecated since 2.5 Use {@link #forType(Class)} instead */ @Deprecated public ObjectReader withType(Class<?> valueType) { return forType(_config.constructType(valueType)); } /** * @deprecated since 2.5 Use {@link #forType(Class)} instead

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>; } } } return result; } finally { try { p.close(); } catch (IOException ioe) { } } } protected JsonNode _bindAndCloseAsTree(JsonParser p) throws IOException { try { return _bindAsTree(p); } finally { try { p.close(); } catch (IOException ioe) { } } } protected JsonNode _bindAsTree(JsonParser p) throws IOException { JsonNode result; JsonToken t = _initForReading(p); if (t == JsonToken.VALUE_NULL || t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = NullNode.instance; } else { DeserializationContext ctxt = createDeserializationContext(p); JsonDeserializer<Object> deser = _findTreeDeserializer(ctxt); if (_unwrapRoot) { result = (JsonNode) _unwrapAndDeserialize(p, ctxt, JSON_NODE_TYPE, deser); } else { result = (JsonNode) deser.deserialize(p, ctxt); } } // Need to consume the token too p.clearCurrentToken(); return result; } /** * @since 2.1 */ protected <T> MappingIterator<T> _bindAndReadValues(JsonParser p) throws IOException { _initForMultiRead(p); p.nextToken(); DeserializationContext ctxt = createDeserializationContext(p); return _newIterator(p, ctxt, _findRootDeserializer(ctxt), true); } protected Object _unwrapAndDeserialize(JsonParser p, DeserializationContext ctxt, JavaType rootType, JsonDeserializer<Object> deser) throws IOException { PropertyName expRootName = _config.findRootName(rootType); // 12-Jun-2015, tatu: Should try to support namespaces etc but... String expSimpleName = expRootName.getSimpleName(); if (p.getCurrentToken() != JsonToken.START_OBJECT) { throw JsonMappingException.from(p, "Current token not START_OBJECT (needed to unwrap root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } if (p.nextToken() != JsonToken.FIELD_NAME) { throw JsonMappingException.from(p, "Current token not FIELD_NAME (to contain expected root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } String actualName = p.getCurrentName(); if (!expSimpleName.equals(actualName)) { throw JsonMappingException.from(p, "Root name '"+actualName+"' does not match expected ('" +expSimpleName+"') for type "+rootType); } // ok, then move to value itself.... p.nextToken(); Object result; if (_valueToUpdate == null) { result = deser.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.createParserWithMatch(); p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); return match.getReader()._bindAndCloseAsTree(p); } /** * Method called to indicate that format detection failed to detect format * of given input */ protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException { // 17-Aug-2015, tatu: Unfortunately, no parser/generator available so: throw new JsonParseException(null, "Can not detect format from input, does not look like any of detectable formats " +detector.toString()); } /* /********************************************************** /* Internal methods, other /********************************************************** */ /** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_parserFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_parserFactory.getFormatName()); } } } /** * Internal helper method called to create an instance of {@link DeserializationContext} * for deserializing a single root value. * Can be overridden if a custom context is needed. */ protected DefaultDeserializationContext createDeserializationContext(JsonParser p) { return _context.createInstance(_config, p, _injectableValues); } protected void _reportUndetectableSource(Object src) throws JsonProcessingException { // 17-Aug-2015, tatu: Unfortunately, no parser/generator available so: throw new JsonParseException(null, "Can not use source of type " +src.getClass().getName()+" with format auto-detection: must be byte- not char-based"); } protected InputStream _inputStream(URL src) throws IOException { return src.openStream(); } protected InputStream _inputStream(File f) throws IOException { return new FileInputStream(f); } /* /********************************************************** /* Helper methods, locating deserializers etc /********************************************************** */ /** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt) throws JsonMappingException { if (_rootDeserializer != null) { return _rootDeserializer; } // Sanity check: must have actual type... JavaType t = _valueType; if (t == null) { throw JsonMappingException.from(ctxt, "No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(t); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = ctxt.

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> standard serializer */ boolean forceTypeInformation = isNaturalTypeWithStdHandling(t.getRawClass(), ser); return withResolved(property, ser, forceTypeInformation); } } else { // 05-Sep-2013, tatu: I _think_ this can be considered a primary property... ser = provider.handlePrimaryContextualization(ser, property); return withResolved(property, ser, _forceTypeInformation); } return this; } /* /********************************************************** /* Actual serialization /********************************************************** */ @Override public void serialize(Object bean, JsonGenerator jgen, SerializerProvider prov) throws IOException { try { Object value = _accessorMethod.invoke(bean); if (value == null) { prov.defaultSerializeNull(jgen); return; } JsonSerializer<Object> ser = _valueSerializer; if (ser == null) { Class<?> c = value.getClass(); /* 10-Mar-2010, tatu: Ideally we would actually separate out type * serializer from value serializer; but, alas, there's no access * to serializer factory at this point... */ // let's cache it, may be needed soon again ser = prov.findTypedValueSerializer(c, true, _property); } ser.serialize(value, jgen, prov); } catch (IOException ioe) { throw ioe; } catch (Exception e) { Throwable t = e; // Need to unwrap this specific type, to see infinite recursion... while (t instanceof InvocationTargetException && t.getCause() != null) { t = t.getCause(); } // Errors shouldn't be wrapped (and often can't, as well) if (t instanceof Error) { throw (Error) t; } // let's try to indicate the path best we can... throw JsonMappingException.wrapWithPath(t, bean, _accessorMethod.getName() + "()"); } } @Override public void serializeWithType(Object bean, JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer0) throws IOException { // Regardless of other parts, first need to find value to serialize: Object value = null; try { value = _accessorMethod.invoke(bean); // and if we got null, can also just write it directly if (value == null) { provider.defaultSerializeNull(jgen); return; } JsonSerializer<Object> ser = _valueSerializer; if (ser == null) { // already got a serializer? fabulous, that be easy... // ser = provider.findTypedValueSerializer(value.getClass(), true, _property); ser = provider.findValueSerializer(value.getClass(), _property); } else { /* 09-Dec-2010, t

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>atu: To work around natural type's refusal to add type info, we do * this (note: type is for the wrapper type, not enclosed value!) */ if (_forceTypeInformation) { typeSer0.writeTypePrefixForScalar(bean, jgen); ser.serialize(value, jgen, provider); typeSer0.writeTypeSuffixForScalar(bean, jgen); return; } } /* 13-Feb-2013, tatu: Turns out that work-around should NOT be required * at all; it would not lead to correct behavior (as per #167). */ // and then redirect type id lookups // TypeSerializer typeSer = new TypeSerializerWrapper(typeSer0, bean); ser.serializeWithType(value, jgen, provider, typeSer0); } catch (IOException ioe) { throw ioe; } catch (Exception e) { Throwable t = e; // Need to unwrap this specific type, to see infinite recursion... while (t instanceof InvocationTargetException && t.getCause() != null) { t = t.getCause(); } // Errors shouldn't be wrapped (and often can't, as well) if (t instanceof Error) { throw (Error) t; } // let's try to indicate the path best we can... throw JsonMappingException.wrapWithPath(t, bean, _accessorMethod.getName() + "()"); } } @SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_valueSerializer instanceof SchemaAware) { return ((SchemaAware)_valueSerializer).getSchema(provider, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { /* 27-Apr-2015, tatu: First things first; for JSON Schema introspection, * Enums are special, and unfortunately we will need to add special * handling here (see https://github.com/FasterXML/jackson-module-jsonSchema/issues/57 * for details). */ Class<?> decl = (typeHint == null) ? null : typeHint.getRawClass(); if (decl == null) { decl = _accessorMethod.getDeclaringClass(); } if ((decl != null) && (decl.isEnum())) { if (_acceptJsonFormatVisitorForEnum(visitor, typeHint, decl)) { return; } } JsonSerializer<Object> ser = _valueSerializer; if (ser == null) { if (typeHint == null) { if (_property != null) { typeHint = _property.getType();

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> } if (typeHint == null) { typeHint = visitor.getProvider().constructType(_handledType); } } ser = visitor.getProvider().findTypedValueSerializer(typeHint, false, _property); if (ser == null) { visitor.expectAnyFormat(typeHint); return; } } ser.acceptJsonFormatVisitor(visitor, null); } /** * Overridable helper method used for special case handling of schema information for * Enums * * @return True if method handled callbacks; false if not; in latter case caller will * send default callbacks * * @since 2.6 */ protected boolean _acceptJsonFormatVisitorForEnum(JsonFormatVisitorWrapper visitor, JavaType typeHint, Class<?> enumType) throws JsonMappingException { // Copied from EnumSerializer#acceptJsonFormatVisitor JsonStringFormatVisitor stringVisitor = visitor.expectStringFormat(typeHint); if (stringVisitor != null) { Set<String> enums = new LinkedHashSet<String>(); for (Object en : enumType.getEnumConstants()) { try { enums.add(String.valueOf(_accessorMethod.invoke(en))); } catch (Exception e) { Throwable t = e; while (t instanceof InvocationTargetException && t.getCause() != null) { t = t.getCause(); } if (t instanceof Error) { throw (Error) t; } throw JsonMappingException.wrapWithPath(t, en, _accessorMethod.getName() + "()"); } } stringVisitor.enumTypes(enums); } return true; } protected boolean isNaturalTypeWithStdHandling(Class<?> rawType, JsonSerializer<?> ser) { // First: do we have a natural type being handled? if (rawType.isPrimitive()) { if (rawType != Integer.TYPE && rawType != Boolean.TYPE && rawType != Double.TYPE) { return false; } } else { if (rawType != String.class && rawType != Integer.class && rawType != Boolean.class && rawType != Double.class) { return false; } } return isDefaultSerializer(ser); } /* /********************************************************** /* Other methods /********************************************************** */ @Override public String toString() { return "(@JsonValue serializer for method " + _accessorMethod.getDeclaringClass() + "#" + _accessorMethod.getName() + ")"; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedParameter; import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams; /** * Default {@link ValueInstantiator} implementation, which supports * Creator methods that can be indicated by standard Jackson * annotations. */ @JacksonStdImpl public class StdValueInstantiator extends ValueInstantiator implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Type of values that are instantiated; used * for error reporting purposes. */ protected final String _valueTypeDesc; // // // Default (no-args) construction /** * Default (no-argument) constructor to use for instantiation * (with {@link #createUsingDefault}) */ protected AnnotatedWithParams _defaultCreator; // // // With-args (property-based) construction protected AnnotatedWithParams _withArgsCreator; protected SettableBeanProperty[] _constructorArguments; // // // Delegate construction protected JavaType _delegateType; protected AnnotatedWithParams _delegateCreator; protected SettableBeanProperty[] _delegateArguments; // // // Array delegate construction protected JavaType _arrayDelegateType; protected AnnotatedWithParams _arrayDelegateCreator; protected SettableBeanProperty[] _arrayDelegateArguments; // // // Scalar construction protected AnnotatedWithParams _fromStringCreator; protected AnnotatedWithParams _fromIntCreator; protected AnnotatedWithParams _fromLongCreator; protected AnnotatedWithParams _fromDoubleCreator; protected AnnotatedWithParams _fromBooleanCreator; // // // Incomplete creator protected AnnotatedParameter _incompleteParameter; /* /********************************************************** /* Life-cycle /********************************************************** */ public StdValueInstantiator(DeserializationConfig config, Class<?> valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.getName(); } public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); } /** * Copy-constructor that sub-classes can use when creating new instances * by fluent-style construction */ protected StdValueInstantiator(StdValueInstantiator src) { _valueTypeDesc = src._valueTypeDesc; _defaultCreator = src._defaultCreator; _constructorArguments = src._constructorArguments; _withArgsCreator = src._withArgsCreator; _delegateType = src._delegateType; _delegateCreator = src._delegateCreator; _delegateArguments

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>5-Nov-2015, tatu: This used to always unwrap the whole exception, but now only // does so if and until `JsonMappingException` is found. for (Throwable curr = t; curr != null; curr = curr.getCause()) { if (curr instanceof JsonMappingException) { return (JsonMappingException) curr; } } return new JsonMappingException(null, "Instantiation of "+getValueTypeDesc()+" value failed: "+t.getMessage(), t); } /** * @since 2.7 */ protected JsonMappingException unwrapAndWrapException(DeserializationContext ctxt, Throwable t) { // 05-Nov-2015, tatu: This used to always unwrap the whole exception, but now only // does so if and until `JsonMappingException` is found. for (Throwable curr = t; curr != null; curr = curr.getCause()) { if (curr instanceof JsonMappingException) { return (JsonMappingException) curr; } } String msg = String.format("Instantiation of %s value failed (%s): %s", getValueTypeDesc(), t.getClass().getName(), t.getMessage()); return JsonMappingException.from(ctxt.getParser(), msg, t); } /** * @since 2.7 */ protected JsonMappingException wrapAsJsonMappingException(DeserializationContext ctxt, Throwable t) { // 05-Nov-2015, tatu: Only avoid wrapping if already a JsonMappingException if (t instanceof JsonMappingException) { return (JsonMappingException) t; } String msg = String.format("Instantiation of %s value failed (%s): %s", getValueTypeDesc(), t.getClass().getName(), t.getMessage()); return JsonMappingException.from(ctxt.getParser(), msg, t); } /** * @since 2.7 */ protected JsonMappingException rewrapCtorProblem(DeserializationContext ctxt, Throwable t) { // 05-Nov-2015, tatu: Seems like there are really only 2 useless wrapper errors/exceptions, // so just peel those, and nothing else if ((t instanceof ExceptionInInitializerError) // from static initialization block || (t instanceof InvocationTargetException) // from constructor/method ) { Throwable cause = t.getCause(); if (cause != null) { t = cause; } } return wrapAsJsonMappingException(ctxt, t); } /* /********************************************************** /* Helper methods /********************************************************** */ private Object _createUsingDelegate( AnnotatedWithParams delegateCreator, SettableBeanProperty[] delegateArguments, DeserializationContext ctxt, Object delegate) throws IOException { if (delegateCreator == null) { // sanity-check; caller should check throw new IllegalStateException("No delegate constructor for "+

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.ser; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.node.ObjectNode; /** * Base class for writers used to output property values (name-value pairs) * as key/value pairs via streaming API. This is the most generic abstraction * implemented by both POJO and {@link java.util.Map} serializers, and invoked * by filtering functionality. * * @since 2.3 */ public abstract class PropertyWriter extends ConcreteBeanPropertyBase // since 2.7 implements java.io.Serializable { private static final long serialVersionUID = 1L; protected PropertyWriter(PropertyMetadata md) { super(md); } protected PropertyWriter(BeanPropertyDefinition propDef) { super(propDef.getMetadata()); } protected PropertyWriter(PropertyWriter base) { super(base); } /* /********************************************************** /* Metadata access /********************************************************** */ @Override public abstract String getName(); @Override public abstract PropertyName getFullName(); /** * Convenience method for accessing annotation that may be associated * either directly on property, or, if not, via enclosing class (context). * This allows adding baseline contextual annotations, for example, by adding * an annotation for a given class and making that apply to all properties * unless overridden by per-property annotations. *<p> * This method is functionally equivalent to: *<pre> * MyAnnotation ann = propWriter.getAnnotation(MyAnnotation.class); * if (ann == null) { * ann = propWriter.getContextAnnotation(MyAnnotation.class); * } *</pre> * that is, tries to find a property annotation first, but if one is not * found, tries to find context-annotation (from enclosing class) of * same type. * * @since 2.5 */ public <A extends Annotation> A findAnnotation(Class<A> acls) { A ann = getAnnotation(acls); if (ann == null) { ann = getContextAnnotation(acls); } return ann; } /** * Method for accessing annotations directly declared for property that this * writer is associated with. * * @since 2.5 */ @Override public abstract <A extends Annotation> A getAnnotation(Class<A> acls); /** * Method for accessing annotations declared in context of the property that this * writer is associated with; usually

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> by using * {@link com.fasterxml.jackson.annotation.JsonManagedReference} */ MANAGED_REFERENCE /** * Reference property that Jackson manages by suppressing it during serialization, * and reconstructing during deserialization. * Usually this can be defined by using * {@link com.fasterxml.jackson.annotation.JsonBackReference} */ ,BACK_REFERENCE ; } private final Type _type; private final String _name; public ReferenceProperty(Type t, String n) { _type = t; _name = n; } public static ReferenceProperty managed(String name) { return new ReferenceProperty(Type.MANAGED_REFERENCE, name); } public static ReferenceProperty back(String name) { return new ReferenceProperty(Type.BACK_REFERENCE, name); } public Type getType() { return _type; } public String getName() { return _name; } public boolean isManagedReference() { return _type == Type.MANAGED_REFERENCE; } public boolean isBackReference() { return _type == Type.BACK_REFERENCE; } } /* /********************************************************** /* Factory methods /********************************************************** */ /** * Factory method for accessing "no operation" implementation * of introspector: instance that will never find any annotation-based * configuration. */ public static AnnotationIntrospector nopInstance() { return NopAnnotationIntrospector.instance; } public static AnnotationIntrospector pair(AnnotationIntrospector a1, AnnotationIntrospector a2) { return new AnnotationIntrospectorPair(a1, a2); } /* /********************************************************** /* Access to possibly chained introspectors /********************************************************** */ /** * Method that can be used to collect all "real" introspectors that * this introspector contains, if any; or this introspector * if it is not a container. Used to get access to all container * introspectors in their priority order. *<p> * Default implementation returns a Singleton list with this introspector * as contents. * This usually works for sub-classes, except for proxy or delegating "container * introspectors" which need to override implementation. */ public Collection<AnnotationIntrospector> allIntrospectors() { return Collections.singletonList(this); } /** * Method that can be used to collect all "real" introspectors that * this introspector contains, if any; or this introspector * if it is not a container. Used to get access to all container * introspectors in their priority order. *<p> * Default implementation adds this introspector in result; this usually * works for sub-classes, except for proxy or delegating "container * introspectors" which need to override implementation. */ public Collection<AnnotationIntrospector> allIntrospectors(

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> structured types (arrays, collections, maps). * * @return Class specifying more general type to use instead of * declared type, if annotation found; null if not * * @deprecated Since 2.7 call {@link #refineSerializationType} instead */ @Deprecated // since 2.7 public Class<?> findSerializationContentType(Annotated am, JavaType baseType) { return null; } /** * Method called to find out possible type refinements to use * for deserialization. * * @since 2.7 */ public JavaType refineSerializationType(final MapperConfig<?> config, final Annotated a, final JavaType baseType) throws JsonMappingException { JavaType type = baseType; final TypeFactory tf = config.getTypeFactory(); // 10-Oct-2015, tatu: For 2.7, we'll need to delegate back to // now-deprecated secondary methods; this because while // direct sub-class not yet retrofitted may only override // those methods. With 2.8 or later we may consider removal // of these methods // Ok: start by refining the main type itself; common to all types Class<?> serClass = findSerializationType(a); if (serClass != null) { if (type.hasRawClass(serClass)) { // 30-Nov-2015, tatu: As per [databind#1023], need to allow forcing of // static typing this way type = type.withStaticTyping(); } else { Class<?> currRaw = type.getRawClass(); try { // 11-Oct-2015, tatu: For deser, we call `TypeFactory.constructSpecializedType()`, // may be needed here too in future? if (serClass.isAssignableFrom(currRaw)) { // common case type = tf.constructGeneralizedType(type, serClass); } else if (currRaw.isAssignableFrom(serClass)) { // specialization, ok as well type = tf.constructSpecializedType(type, serClass); } else { throw new JsonMappingException(null, String.format("Can not refine serialization type %s into %s; types not related", type, serClass.getName())); } } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, String.format("Failed to widen type %s with annotation (value %s), from '%s': %s", type, serClass.getName(), a.getName(), iae.getMessage()), iae); } } } // Then further processing for container types // First, key type (for Maps, Map-like types): if (type.isMapLikeType()) { JavaType keyType = type.getKeyType(); Class<?> keyClass = find

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>SerializationKeyType(a, keyType); if (keyClass != null) { if (keyType.hasRawClass(keyClass)) { keyType = keyType.withStaticTyping(); } else { Class<?> currRaw = keyType.getRawClass(); try { // 19-May-2016, tatu: As per [databind#1231], [databind#1178] may need to actually // specialize (narrow) type sometimes, even if more commonly opposite // is needed. if (keyClass.isAssignableFrom(currRaw)) { // common case keyType = tf.constructGeneralizedType(keyType, keyClass); } else if (currRaw.isAssignableFrom(keyClass)) { // specialization, ok as well keyType = tf.constructSpecializedType(keyType, keyClass); } else { throw new JsonMappingException(null, String.format("Can not refine serialization key type %s into %s; types not related", keyType, keyClass.getName())); } } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, String.format("Failed to widen key type of %s with concrete-type annotation (value %s), from '%s': %s", type, keyClass.getName(), a.getName(), iae.getMessage()), iae); } } type = ((MapLikeType) type).withKeyType(keyType); } } JavaType contentType = type.getContentType(); if (contentType != null) { // collection[like], map[like], array, reference // And then value types for all containers: Class<?> contentClass = findSerializationContentType(a, contentType); if (contentClass != null) { if (contentType.hasRawClass(contentClass)) { contentType = contentType.withStaticTyping(); } else { // 03-Apr-2016, tatu: As per [databind#1178], may need to actually // specialize (narrow) type sometimes, even if more commonly opposite // is needed. Class<?> currRaw = contentType.getRawClass(); try { if (contentClass.isAssignableFrom(currRaw)) { // common case contentType = tf.constructGeneralizedType(contentType, contentClass); } else if (currRaw.isAssignableFrom(contentClass)) { // specialization, ok as well contentType = tf.constructSpecializedType(contentType, contentClass); } else { throw new JsonMappingException(null, String.format("Can not refine serialization content type %s into %s; types not related", contentType, contentClass.getName())); } } catch (IllegalArgumentException iae) { // shouldn't really happen throw new JsonMappingException(null, String.format("Internal error: failed to refine value type of %s with concrete-type annotation (value %s

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>), from '%s': %s", type, contentClass.getName(), a.getName(), iae.getMessage()), iae); } } type = type.withContentType(contentType); } } return type; } /* /********************************************************** /* Serialization: class annotations /********************************************************** */ /** * Method for accessing defined property serialization order (which may be * partial). May return null if no ordering is defined. */ public String[] findSerializationPropertyOrder(AnnotatedClass ac) { return null; } /** * Method for checking whether an annotation indicates that serialized properties * for which no explicit is defined should be alphabetically (lexicograpically) * ordered */ public Boolean findSerializationSortAlphabetically(Annotated ann) { return null; } /** * Method for adding possible virtual properties to be serialized along * with regular properties. * * @since 2.5 */ public void findAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, List<BeanPropertyWriter> properties) { } /* /********************************************************** /* Serialization: property annotations /********************************************************** */ /** * Method for checking whether given property accessors (method, * field) has an annotation that suggests property name to use * for serialization. * Should return null if no annotation * is found; otherwise a non-null name (possibly * {@link PropertyName#USE_DEFAULT}, which means "use default heuristics"). * * @param a Property accessor to check * * @return Name to use if found; null if not. * * @since 2.1 */ public PropertyName findNameForSerialization(Annotated a) { /* if (name != null) { if (name.length() == 0) { // empty String means 'default' return PropertyName.USE_DEFAULT; } return new PropertyName(name); } */ return null; } /** * Method for checking whether given method has an annotation * that suggests that the return value of annotated method * should be used as "the value" of the object instance; usually * serialized as a primitive value such as String or number. * * @return True if such annotation is found (and is not disabled); * false if no enabled annotation is found */ public boolean hasAsValueAnnotation(AnnotatedMethod am) { return false; } // TODO: Deprecate in 2.8? /** * Method for determining the String value to use for serializing * given enumeration entry; used when serializing enumerations * as Strings (the standard method). * * @return Serialized enum value. */ public String findEnumValue(Enum<?> value) { return value.name(); } /** * Method for efficiently figuring out which if given set of <code>Enum</code> values

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>); } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, String.format("Failed to narrow type %s with annotation (value %s), from '%s': %s", type, valueClass.getName(), a.getName(), iae.getMessage()), iae); } } // Then further processing for container types // First, key type (for Maps, Map-like types): if (type.isMapLikeType()) { JavaType keyType = type.getKeyType(); Class<?> keyClass = findDeserializationKeyType(a, keyType); if (keyClass != null) { try { keyType = tf.constructSpecializedType(keyType, keyClass); type = ((MapLikeType) type).withKeyType(keyType); } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, String.format("Failed to narrow key type of %s with concrete-type annotation (value %s), from '%s': %s", type, keyClass.getName(), a.getName(), iae.getMessage()), iae); } } } JavaType contentType = type.getContentType(); if (contentType != null) { // collection[like], map[like], array, reference // And then value types for all containers: Class<?> contentClass = findDeserializationContentType(a, contentType); if (contentClass != null) { try { contentType = tf.constructSpecializedType(contentType, contentClass); type = type.withContentType(contentType); } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, String.format("Failed to narrow value type of %s with concrete-type annotation (value %s), from '%s': %s", type, contentClass.getName(), a.getName(), iae.getMessage()), iae); } } } return type; } /** * Method for accessing annotated type definition that a * property can have, to be used as the type for deserialization * instead of the static (declared) type. * Type is usually narrowing conversion (i.e.subtype of declared type). * Declared return type of the method is also considered acceptable. * * @param baseType Assumed type before considering annotations * * @return Class to use for deserialization instead of declared type * * @deprecated Since 2.7 call {@link #refineDeserializationType} instead */ @Deprecated public Class<?> findDeserializationType(Annotated am, JavaType baseType) { return null; } /** * Method for accessing additional narrowing type definition that a * method can have, to define more specific key type to use. * It should be only be used with {@link java.util.Map} types. * * @param baseKeyType Assumed key type before considering annotations * * @return Class specifying more specific type to use

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.introspect; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.type.TypeBindings; /** * Shared base class used for anything on which annotations (included * within a {@link AnnotationMap}). */ public abstract class Annotated { protected Annotated() { } public abstract <A extends Annotation> A getAnnotation(Class<A> acls); public abstract boolean hasAnnotation(Class<?> acls); /** * @since 2.7 */ public abstract boolean hasOneOf(Class<? extends Annotation>[] annoClasses); /** * Fluent factory method that will construct a new instance that uses specified * instance annotations instead of currently configured ones. */ public abstract Annotated withAnnotations(AnnotationMap fallback); /** * Fluent factory method that will construct a new instance that uses * annotations from specified {@link Annotated} as fallback annotations */ public final Annotated withFallBackAnnotationsFrom(Annotated annotated) { return withAnnotations(AnnotationMap.merge(getAllAnnotations(), annotated.getAllAnnotations())); } /** * Method that can be used to find actual JDK element that this instance * represents. It is non-null, except for method/constructor parameters * which do not have a JDK counterpart. */ public abstract AnnotatedElement getAnnotated(); protected abstract int getModifiers(); public final boolean isPublic() { return Modifier.isPublic(getModifiers()); } public abstract String getName(); /** * Full generic type of the annotated element; definition * of what exactly this means depends on sub-class. * * @since 2.7 */ public abstract JavaType getType(); /** * @deprecated Since 2.7 Use {@link #getType()} instead. To be removed from 2.8. */ @Deprecated public final JavaType getType(TypeBindings bogus) { return getType(); } /** * JDK declared generic type of the annotated element; definition * of what exactly this means depends on sub-class. Note that such type * can not be reliably resolved without {@link TypeResolutionContext}, and * as a result use of this method was deprecated in Jackson 2.7: see * {@link #getType} for replacement. * * @deprecated Since 2.7 should instead use {@link #getType()}. To be removed from 2.8 */ @Deprecated public Type getGenericType() { return getRawType(); } /** * "Raw" type (type-erased class) of the annotated element; definition * of what exactly this means depends on sub-class. */ public abstract Class<?> getRawType(); /** * Accessor

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> that can be used to iterate over all the annotations * associated with annotated component. * * @since 2.3 */ public abstract Iterable<Annotation> annotations(); /** * Internal helper method used to access annotation information; * not exposed to developers since instances are mutable. */ protected abstract AnnotationMap getAllAnnotations(); // Also: ensure we can use #equals, #hashCode @Override public abstract boolean equals(Object o); @Override public abstract int hashCode(); @Override public abstract String toString(); }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>; int pendingIx = 0; for (; p.getCurrentToken() != JsonToken.END_OBJECT; p.nextToken()) { String propName = p.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(propName); p.nextToken(); // to point to field value if (prop != null) { // normal case if (throwable != null) { prop.deserializeAndSet(p, ctxt, throwable); continue; } // nope; need to defer if (pending == null) { int len = _beanProperties.size(); pending = new Object[len + len]; } pending[pendingIx++] = prop; pending[pendingIx++] = prop.deserialize(p, ctxt); continue; } // Maybe it's "message"? if (PROP_NAME_MESSAGE.equals(propName)) { if (hasStringCreator) { throwable = _valueInstantiator.createFromString(ctxt, p.getText()); // any pending values? if (pending != null) { for (int i = 0, len = pendingIx; i < len; i += 2) { prop = (SettableBeanProperty)pending[i]; prop.set(throwable, pending[i+1]); } pending = null; } continue; } } // Things marked as ignorable should not be passed to any setter if ((_ignorableProps != null) && _ignorableProps.contains(propName)) { p.skipChildren(); continue; } if (_anySetter != null) { _anySetter.deserializeAndSet(p, ctxt, throwable, propName); continue; } // Unknown: let's call handler method handleUnknownProperty(p, ctxt, throwable, propName); } // Sanity check: did we find "message"? if (throwable == null) { /* 15-Oct-2010, tatu: Can't assume missing message is an error, since it may be * suppressed during serialization, as per [JACKSON-388]. * * Should probably allow use of default constructor, too... */ //throw new JsonMappingException("No 'message' property found: could not deserialize "+_beanType); if (hasStringCreator) { throwable = _valueInstantiator.createFromString(ctxt, null); } else { throwable = _valueInstantiator.createUsingDefault(ctxt); } // any pending values? if (pending != null) { for (int i = 0, len = pendingIx; i < len; i += 2) { SettableBeanProperty prop = (SettableBeanProperty)pending[i]; prop.set(throwable, pending[i+1]); } } } return throwable; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>.getInstance(); } /** * Method to use for accessing all fields (with both names * and values) of this JSON Object. */ @Override public Iterator<Map.Entry<String, JsonNode>> fields() { return _children.entrySet().iterator(); } @Override public ObjectNode with(String propertyName) { JsonNode n = _children.get(propertyName); if (n != null) { if (n instanceof ObjectNode) { return (ObjectNode) n; } throw new UnsupportedOperationException("Property '" + propertyName + "' has value that is not of type ObjectNode (but " + n .getClass().getName() + ")"); } ObjectNode result = objectNode(); _children.put(propertyName, result); return result; } @Override public ArrayNode withArray(String propertyName) { JsonNode n = _children.get(propertyName); if (n != null) { if (n instanceof ArrayNode) { return (ArrayNode) n; } throw new UnsupportedOperationException("Property '" + propertyName + "' has value that is not of type ArrayNode (but " + n .getClass().getName() + ")"); } ArrayNode result = arrayNode(); _children.put(propertyName, result); return result; } @Override public boolean equals(Comparator<JsonNode> comparator, JsonNode o) { if (!(o instanceof ObjectNode)) { return false; } ObjectNode other = (ObjectNode) o; Map<String, JsonNode> m1 = _children; Map<String, JsonNode> m2 = other._children; final int len = m1.size(); if (m2.size() != len) { return false; } for (Map.Entry<String, JsonNode> entry : m1.entrySet()) { JsonNode v2 = m2.get(entry.getKey()); if ((v2 == null) || !entry.getValue().equals(comparator, v2)) { return false; } } return true; } /* /********************************************************** /* Public API, finding value nodes /********************************************************** */ @Override public JsonNode findValue(String fieldName) { for (Map.Entry<String, JsonNode> entry : _children.entrySet()) { if (fieldName.equals(entry.getKey())) { return entry.getValue(); } JsonNode value = entry.getValue().findValue(fieldName); if (value != null) { return value; } } return null; } @Override public List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar) { for (Map.Entry<String, JsonNode> entry : _children.entrySet()) { if (fieldName.equals(entry.getKey())) { if (foundSoFar == null) { foundSoFar = new ArrayList<JsonNode>(); } foundSoFar.add

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>(entry.getValue()); } else { // only add children if parent not added foundSoFar = entry.getValue().findValues(fieldName, foundSoFar); } } return foundSoFar; } @Override public List<String> findValuesAsText(String fieldName, List<String> foundSoFar) { for (Map.Entry<String, JsonNode> entry : _children.entrySet()) { if (fieldName.equals(entry.getKey())) { if (foundSoFar == null) { foundSoFar = new ArrayList<String>(); } foundSoFar.add(entry.getValue().asText()); } else { // only add children if parent not added foundSoFar = entry.getValue().findValuesAsText(fieldName, foundSoFar); } } return foundSoFar; } @Override public ObjectNode findParent(String fieldName) { for (Map.Entry<String, JsonNode> entry : _children.entrySet()) { if (fieldName.equals(entry.getKey())) { return this; } JsonNode value = entry.getValue().findParent(fieldName); if (value != null) { return (ObjectNode) value; } } return null; } @Override public List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar) { for (Map.Entry<String, JsonNode> entry : _children.entrySet()) { if (fieldName.equals(entry.getKey())) { if (foundSoFar == null) { foundSoFar = new ArrayList<JsonNode>(); } foundSoFar.add(this); } else { // only add children if parent not added foundSoFar = entry.getValue() .findParents(fieldName, foundSoFar); } } return foundSoFar; } /* /********************************************************** /* Public API, serialization /********************************************************** */ /** * Method that can be called to serialize this node and * all of its descendants using specified JSON generator. */ @Override public void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeStartObject(); for (Map.Entry<String, JsonNode> en : _children.entrySet()) { jg.writeFieldName(en.getKey()); /* 17-Feb-2009, tatu: Can we trust that all nodes will always * extend BaseJsonNode? Or if not, at least implement * JsonSerializable? Let's start with former, change if * we must. */ ((BaseJsonNode) en.getValue()).serialize(jg, provider); } jg.writeEndObject(); } @Override public void serializeWithType(JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { typeSer.writeTypePrefixFor

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> public ObjectNode put(String fieldName, boolean v) { return _put(fieldName, booleanNode(v)); } /** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, Boolean v) { return _put(fieldName, (v == null) ? nullNode() : booleanNode(v.booleanValue())); } /** * Method for setting value of a field to specified binary value * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, byte[] v) { return _put(fieldName, (v == null) ? nullNode() : binaryNode(v)); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof ObjectNode) { return _childrenEqual((ObjectNode) o); } return false; } /** * @since 2.3 */ protected boolean _childrenEqual(ObjectNode other) { return _children.equals(other._children); } @Override public int hashCode() { return _children.hashCode(); } @Override public String toString() { StringBuilder sb = new StringBuilder(32 + (size() << 4)); sb.append("{"); int count = 0; for (Map.Entry<String, JsonNode> en : _children.entrySet()) { if (count > 0) { sb.append(","); } ++count; TextNode.appendQuoted(sb, en.getKey()); sb.append(':'); sb.append(en.getValue().toString()); } sb.append("}"); return sb.toString(); } /* /********************************************************** /* Internal methods (overridable) /********************************************************** */ protected ObjectNode _put(String fieldName, JsonNode value) { _children.put(fieldName, value); return this; } }

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains 64-bit ("double precision") * floating point values simple 32-bit integer values. */ public class DoubleNode extends NumericNode { protected final double _value; /* /********************************************************** /* Construction /********************************************************** */ public DoubleNode(double v) { _value = v; } public static DoubleNode valueOf(double v) { return new DoubleNode(v); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.DOUBLE; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isDouble() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return (_value >= Long.MIN_VALUE && _value <= Long.MAX_VALUE); } @Override public Number numberValue() { return Double.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return (long) _value; } @Override public float floatValue() { return (float) _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); } @Override public String asText() { return NumberOutput.toString(_value); } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof DoubleNode) { // We must account for NaNs: NaN does not equal NaN, therefore we have // to use Double.compare(). final double otherValue = ((DoubleNode) o)._value; return Double.compare(_value,

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS>FLOAT: { Object n = segment.get(ptr); if (n instanceof Double) { gen.writeNumber(((Double) n).doubleValue()); } else if (n instanceof BigDecimal) { gen.writeNumber((BigDecimal) n); } else if (n instanceof Float) { gen.writeNumber(((Float) n).floatValue()); } else if (n == null) { gen.writeNull(); } else if (n instanceof String) { gen.writeNumber((String) n); } else { throw new JsonGenerationException(String.format( "Unrecognized value type for VALUE_NUMBER_FLOAT: %s, can not serialize", n.getClass().getName()), gen); } } break; case VALUE_TRUE: gen.writeBoolean(true); break; case VALUE_FALSE: gen.writeBoolean(false); break; case VALUE_NULL: gen.writeNull(); break; case VALUE_EMBEDDED_OBJECT: { Object value = segment.get(ptr); if (value instanceof RawValue) { ((RawValue) value).serialize(gen); } else { gen.writeObject(value); } } break; default: throw new RuntimeException("Internal error: should never end up through this code path"); } } } /** * Helper method used by standard deserializer. * * @since 2.3 */ public TokenBuffer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.getCurrentTokenId() != JsonToken.FIELD_NAME.id()) { copyCurrentStructure(p); return this; } /* 28-Oct-2014, tatu: As per [databind#592], need to support a special case of starting from * FIELD_NAME, which is taken to mean that we are missing START_OBJECT, but need * to assume one did exist. */ JsonToken t; writeStartObject(); do { copyCurrentStructure(p); } while ((t = p.nextToken()) == JsonToken.FIELD_NAME); if (t != JsonToken.END_OBJECT) { throw ctxt.mappingException("Expected END_OBJECT after copying contents of a JsonParser into TokenBuffer, got "+t); } writeEndObject(); return this; } @Override @SuppressWarnings("resource") public String toString() { // Let's print up to 100 first tokens... final int MAX_COUNT = 100; StringBuilder sb = new StringBuilder(); sb.append("[TokenBuffer: "); /* sb.append("NativeTypeIds=").append(_hasNativeTypeIds).append(","); sb.append("NativeObjectIds=").append(_hasNativeObjectIds).append(","); */ JsonParser jp = asParser(); int count = 0

JacksonDatabind, 58

<FILEB>
<CHANGES>
if ((mutator instanceof AnnotatedField)
&& "cause".equals(mutator.getName())) {
;
} else {
<CHANGEE>
<CHANGES>
}
<CHANGEE>
<FILEE>
<FILEB> /** * Method that will construct a regular bean property setter using * the given setter method. * * @return Property constructed, if any; or null to indicate that * there should be no property based on given definitions. */ protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); if (ctxt.canOverrideAccessModifiers()) { // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; // never needed and attempts may cause problems on some platforms. // !!! NOTE: should be handled better for 2.8 and later <CHANGES> <CHANGEE> mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); <CHANGES> <CHANGEE> } // note: this works since we know there's exactly one argument for methods BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), propType0, propDef.getWrapperName(), beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); // did type change? if (type != propType0) { property = property.withType(type); } // First: does the Method specify the deserializer to use? If so, let's use it. JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, mutator); <FILEE> <SCANS> (n instanceof Short) return NumberType.INT; // should be SHORT return null; } @Override public final Number getNumberValue() throws IOException { _checkIsNumber(); Object value = _currentObject(); if (value instanceof Number) { return (Number) value; } // Difficult to really support numbers-as-Strings; but let's try. // NOTE: no access to DeserializationConfig, unfortunately, so can not // try to determine Double/BigDecimal preference... if (value instanceof String) { String str = (String) value; if (str.indexOf('.') >= 0) { return Double.parseDouble(str); } return Long.parseLong(str); } if (value == null) { return null; } throw new IllegalStateException("Internal error: entry should be a Number, but is of type " +value.getClass().getName()); } /* /********************************************************** /* Public API, access to token information, other /********************************************************** */ @Override public Object getEmbeddedObject() { if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { return _currentObject(); } return null; } @Override @SuppressWarnings("resource") public byte[] getBinaryValue(Base64Variant b64variant) throws IOException, JsonParseException { // First: maybe we some special types? if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { // Embedded byte array would work nicely... Object ob = _currentObject(); if (ob instanceof byte[]) { return (byte[]) ob; } // fall through to error case } if (_currToken != JsonToken.VALUE_STRING) { throw _constructError("Current token ("+_currToken+") not VALUE_STRING (or VALUE_EMBEDDED_OBJECT with byte[]), can not access as binary"); } final String str = getText(); if (str == null) { return null; } ByteArrayBuilder builder = _byteBuilder; if (builder == null) { _byteBuilder = builder = new ByteArrayBuilder(100); } else { _byteBuilder.reset(); } _decodeBase64(str, builder, b64variant); return builder.toByteArray(); } @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { byte[] data = getBinaryValue(b64variant); if (data != null) { out.write(data, 0, data.length); return data.length; } return 0; } /* /********************************************************** /* Public API, native ids /********************************************************** */ @Override public boolean canReadObjectId() { return _hasNativeObjectIds; } @Override public boolean canReadTypeId()